Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embed: go get and go.work disagree on what is included in an embed.FS #71978

Closed
jsteenb2 opened this issue Feb 26, 2025 · 0 comments
Closed

embed: go get and go.work disagree on what is included in an embed.FS #71978

jsteenb2 opened this issue Feb 26, 2025 · 0 comments

Comments

@jsteenb2
Copy link

jsteenb2 commented Feb 26, 2025

Go version

go version go1.24.0 darwin/arm64

Output of go env in your module/workspace:

AR='ar'
CC='cc'
CXX='c++'
GCCGO='gccgo'
GO111MODULE='on'
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN='***'
GOCACHE='***'
GOCACHEPROG=''
GODEBUG=''
GOENV='***'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/nc/_09t16c10vl89ld5s0jkkg3h0000gn/T/go-build1473942521=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='***'
GONOPROXY='***' # lists our local VCS
GONOSUMDB='***' # lists our local VCS
GOOS='darwin'
GOPATH='***'
GOPRIVATE='***' # lists our local VCS
GOPROXY='***' # lists our local VCS proxy
GOROOT='/opt/homebrew/Cellar/go/1.24.0/libexec'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOVCS=''
GOVERSION='go1.24.0'
GOWORK=''

What did you do?

When working with the //go:embed, I ran into an issue where it performed differently when working locally with go.work vs pulling the module using go get.

I have created a reproduction of the issue using a couple of modules:

For context, the embedvendor is representing a server that we created for tests that acts like it is accessing a VCS server. We utilize this across other modules. There are no go files in the vendor directories.

What did you see happen?

I have the getvendor module that depends on embedvendor. Everything works as expected when working with go.work accessing it from my local development environment. However, when I use go get to pull the module, the embed.FS within embedvendor is missing entire paths that include **/vendor/** in it.

I set up a test in embedvendor/fs_test.go to validate the entire embed.FS is available. It passes as expected.

However, inside getvendor/fs_test.go, I get a failure indicating the paths with vendor/ in it are missing.

If you add the go.work into the getvendor module and wire in the embedvendor from your filesystem, the tests pass. This disagreement was jarring and took a good while to determine.

What did you expect to see?

I expected the getvendor to have access to the entire embed.FS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants