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/go2go: build tags not supported correctly #39998
Comments
It happens because translator does not copy magic comments from //go:noinline
func Foo() {
} becomes //line <original code line>
func Foo() {
} |
FWIW, how go-fuzz handles this is by looking for initial comments and //go directives, saving them, manipulating the code (inserting coverage), and then re-inserting the comments. See functions initialComments and trimComments and related code in go-fuzz-build. |
I don't know off-hand how much effort is needed to make this work, but we may decide to not do anything about it. Keep in mind this is a prototype to explore the generics mechanisms; anything and everything may change as we go forward. |
It's not just a matter of magic comments. The type checker gets a list of files, and it expects that build tags have already been applied at that point to remove files that it shouldn't see. I don't mind if somebody fixes this, but I don't plan to work on it myself. The go2go tool is meant to be an experimental translation tool, it's not meant to handle all details of how Go packages are built. |
I have a submitted a simple PR that should be helpful to most people tinkering with generics via go2go, #45147. |
The PR has been merged. |
commit d014fca
The go2go tool doesn't seem to recognise go build tags, which means that it's not possible to use external packages that use them (I was bitten when trying to import github.com/frankban/quicktest, for the record).
Here's a testscript reproducer:
The text was updated successfully, but these errors were encountered: