diff options
author | Ian Lance Taylor <iant@golang.org> | 2022-02-11 14:53:56 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2022-02-11 15:01:19 -0800 |
commit | 8dc2499aa62f768c6395c9754b8cabc1ce25c494 (patch) | |
tree | 43d7fd2bbfd7ad8c9625a718a5e8718889351994 /libgo/go/embed/embed.go | |
parent | 9a56779dbc4e2d9c15be8d31e36f2f59be7331a8 (diff) | |
download | gcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.zip gcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.tar.gz gcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.tar.bz2 |
libgo: update to Go1.18beta2
gotools/
* Makefile.am (go_cmd_cgo_files): Add ast_go118.go
(check-go-tool): Copy golang.org/x/tools directories.
* Makefile.in: Regenerate.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/384695
Diffstat (limited to 'libgo/go/embed/embed.go')
-rw-r--r-- | libgo/go/embed/embed.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libgo/go/embed/embed.go b/libgo/go/embed/embed.go index 851cc21..9737ccd 100644 --- a/libgo/go/embed/embed.go +++ b/libgo/go/embed/embed.go @@ -80,11 +80,15 @@ // var content embed.FS // // The difference is that ‘image/*’ embeds ‘image/.tempfile’ while ‘image’ does not. +// Neither embeds ‘image/dir/.tempfile’. +// +// If a pattern begins with the prefix ‘all:’, then the rule for walking directories is changed +// to include those files beginning with ‘.’ or ‘_’. For example, ‘all:image’ embeds +// both ‘image/.tempfile’ and ‘image/dir/.tempfile’. // // The //go:embed directive can be used with both exported and unexported variables, // depending on whether the package wants to make the data available to other packages. -// It can only be used with global variables at package scope, -// not with local variables. +// It can only be used with variables at package scope, not with local variables. // // Patterns must not match files outside the package's module, such as ‘.git/*’ or symbolic links. // Matches for empty directories are ignored. After that, each pattern in a //go:embed line @@ -228,7 +232,7 @@ func (f *file) Name() string { _, elem, _ := split(f.name); return func (f *file) Size() int64 { return int64(len(f.data)) } func (f *file) ModTime() time.Time { return time.Time{} } func (f *file) IsDir() bool { _, _, isDir := split(f.name); return isDir } -func (f *file) Sys() interface{} { return nil } +func (f *file) Sys() any { return nil } func (f *file) Type() fs.FileMode { return f.Mode().Type() } func (f *file) Info() (fs.FileInfo, error) { return f, nil } @@ -292,6 +296,8 @@ func (f FS) readDir(dir string) []file { } // Open opens the named file for reading and returns it as an fs.File. +// +// The returned file implements io.Seeker when the file is not a directory. func (f FS) Open(name string) (fs.File, error) { file := f.lookup(name) if file == nil { @@ -339,6 +345,10 @@ type openFile struct { offset int64 // current read offset } +var ( + _ io.Seeker = (*openFile)(nil) +) + func (f *openFile) Close() error { return nil } func (f *openFile) Stat() (fs.FileInfo, error) { return f.f, nil } |