/ go Public
cmd/go: generate should set GOFLAGS env variable #27898
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
What did you do?
Given the following setup:
Then the following two command produce no output, i.e.
go generatedoesn't find any directives:
Only when we combine the setting of
GOARCHand build tags is the directive run:
This makes sense; per
go help generate,
GOARCHare passed through by
go generateto each directive:
However build tags are not, despite build tags clearly influencing the files that are scanned for directives.
So assuming the observed behaviour is correct/consistent, I'd like to propose that we add a
GOBUILDTAGSenv variable to complement
GOARCH. This would pass through the
The use case here is needing to pass
GOARCHand build tags as supplied to
go generateto a generator that uses
go/packagesfor type checking.
cc @robpike @rsc @bcmills
The text was updated successfully, but these errors were encountered: