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
syscall: cannot use go generate to invoke mksyscall_windows.go on linux #16368
Comments
See issue golang/go#16368 for details. Updates golang/go#16368 Change-Id: I6fe194b34ff9bb24d78e93a1bca76245385759f4 Reviewed-on: https://go-review.googlesource.com/24951 Reviewed-by: Nigel Tao <nigeltao@golang.org>
CL https://golang.org/cl/24952 mentions this issue. |
See issue golang/go#16368 for details. Updates golang/go#16368 Change-Id: Ic3294385a350aee41887f59cbcf5b0af7742ff3b Reviewed-on: https://go-review.googlesource.com/24952 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Does this commit actually fix anything? Won't GOOS and GOARCH still be set to the wrong values when running the go:generate commands? |
In the case of the syscall package, the mksyscall_windows command does not care about |
Aha, this change makes it work if you run go generate without GOOS set. I was thinking of the case where someone has GOOS set in their environment already, and it will be passed through no matter which file the go:generate is in. |
Yes, that is how I am going to use this tool in the future.
I don't understand the scenario you are describing. Please provide a particular example. We use "go run ..." command here. So if you set GOOS != GOHOSTOS, then it will not work - you will get confusing error message just like mine above. Alex |
I was thinking of:
or something along those lines. I was thinking that a fix would be to make the go:generate comment be something like
|
I tried that, and I get same error as before. I don't see anything different from my approach that I've described in the bug itself.
I don't think this will fly on windows, if you expect Windows cmd.exe to interpret your command line as is. There is no "env" command. You cannot set global variables on the same command line. And cmd.exe does not use $ for environment variables. And I don't think we want to change "go generate" to "process" its command lines before passing them to the OS. Anyway Ian's suggestion works for me for the moment. I had to add odd source file here or there, but it is small price to pay. Alex |
CL https://golang.org/cl/27411 mentions this issue. |
CL https://golang.org/cl/27832 mentions this issue. |
genzabbrs.go uses whatever zoneinfo database available on the system. This makes genzabbrs.go output change from system to system. Adjust go:generate line to always use $GOROOT/lib/time/zoneinfo.zip, so it does not matter who runs the command. Also move go:generate line into zoneinfo.go, so it can be run on Unix (see #16368 for details). Fixes #15802. Change-Id: I8ae4818aaf40795364e180d7bb4326ad7c07c370 Reviewed-on: https://go-review.googlesource.com/27832 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
To avoid cross platform go generate issue Look at golang/go#16368
Before go1.7 I could use
go generate
to generate $GOROOT\src\syscall\zsyscall_windows.go on my Linux computer. Not anymore:This is because
go generate
command respect GOOS and GOARCH now. I tried runninggo generate
without GOOS=windows, but it does nothing because //go:generate is in syscall_windows.go (windows only file).Ian suggested (#16120 (comment)) we should move //go:generate line into syscall.go.
We have other packags std and x/... that use mksyscall_windows.go in a similar fashion. This issue is to make sure everything is fixed.
Alex
The text was updated successfully, but these errors were encountered: