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

cmd/go: go install / go.mod / go:embed / build tags don't play well together. #47109

Closed
james-lawrence opened this issue Jul 9, 2021 · 3 comments

Comments

@james-lawrence
Copy link
Contributor

james-lawrence commented Jul 9, 2021

have a program where I have three files:

workspace_16.go which contains // +build go1.16 and a go:embed
workspace_15.go // +build !go1.16
workspace.go

and a go.mod with
go 1.14

cmd/bw/workspace_16.go:64:3: go:embed requires go1.16 or later (-lang was set to go1.14; check go.mod)

expect it to build properly.

@jayconrod jayconrod changed the title go install / go.mod / go:embed / build tags don't play well together. cmd/go: go install / go.mod / go:embed / build tags don't play well together. Jul 9, 2021
@jayconrod
Copy link
Contributor

The go directive in go.mod is the problem here. It needs to be go 1.16 or higher.

Closing since this seems like it's working as intended. Your +build tags look like they should work.

But #30791 is related. The go directive is not all that well-documented or understood.

@james-lawrence
Copy link
Contributor Author

james-lawrence commented Jul 10, 2021

@jayconrod I believe you misunderstood the problem. it doesn't build, the source code with the build tags should build properly for both go 1.14, 1.15, and 1.16. 1.16 isn't the minimum version. changing go.mod to use version 1.16 would prevent it from building with go 1.14.

edit: waiting on results from CI, I believe i may have made an erroneous assumption on the build failure based on local builds. =)

@james-lawrence
Copy link
Contributor Author

@jayconrod nm then, I stand corrected. the error in CI was from an import that didn't get autoremoved during save. sigh

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

No branches or pull requests

3 participants