Closed
Description
What version of Go are you using (go version
)?
Tip.
$ gotip version go version devel +48be3ed Sat Oct 31 00:35:33 2020 +0000 darwin/amd64
Does this issue reproduce with the latest release?
Yes.
What did you do?
Tried out the new embed.FS feature.
example.go:
package main
import (
"embed"
"fmt"
"io/fs"
)
func main() {
//go:embed example/*
var files embed.FS
des, _ := fs.ReadDir(files, "example")
for _, de := range des {
fmt.Printf("%q\n", de.Name())
}
}
example:
total 1504
drwxr-xr-x@ 6 adhoc staff 192 Oct 30 21:49 .
drwx------ 8 adhoc staff 256 Nov 1 13:34 ..
-rw-r--r--@ 1 adhoc staff 6148 Oct 30 21:49 .DS_Store
-rw-r--r-- 1 adhoc staff 0 Oct 30 21:47 .dot
-rw-r--r--@ 1 adhoc staff 0 Oct 30 21:48 Icon
-rw-r--r-- 1 adhoc staff 0 Oct 30 21:47 one.txt
What did you expect to see?
$ gotip run .
"one.txt"
What did you see instead?
$ gotip run .
".DS_Store"
".dot"
"Icon\r"
"one.txt"
There should be a warning in the documentation that dotfiles and hidden files are included.