You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most examples I see specify how to use the go:embed directive to point to a particular file, and reading that particular file using ReadFile(). Or defining a directory in the go:embed directive, and using http.FS() to host that folder. However, I could not find an example of using // go:embed files/* to embed the entire directory, then trying to directly read a file located inside that directory using ReadFile(). Therefore, I wanted to know if this is even possible.
What did you expect to see?
Successful file read.
What did you see instead?
panic: open files/hello.txt: file does not exist
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Created a simple example to see how I can replace https://github.com/gilgameshskytrooper/go-bindata with native 1.16 file embed functionality.
hello.txt
go.mod
main.go
Most examples I see specify how to use the
go:embed
directive to point to a particular file, and reading that particular file usingReadFile()
. Or defining a directory in thego:embed
directive, and usinghttp.FS()
to host that folder. However, I could not find an example of using// go:embed files/*
to embed the entire directory, then trying to directly read a file located inside that directory usingReadFile()
. Therefore, I wanted to know if this is even possible.What did you expect to see?
Successful file read.
What did you see instead?
The text was updated successfully, but these errors were encountered: