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
x/text/cmd/gotext: generate for one GOOS/GOARCH from a different GOOS/GOARCH #37846
Comments
The basic problem here is a slightly more lower level one -- passing one GOOS to |
For example |
@zx2c4 can you use https://go-review.googlesource.com/c/go/+/175983/ Alex |
Not sure that will help. The issue is that |
As a workaround, perhaps your |
That works, but winds up being really ugly: https://git.zx2c4.com/wireguard-windows/tree/gotext.go?id=2a211c5d1248774996f24e50067400326fd91a05 I don't like duplicating the build environment variables inside of that, or having to pick a temporary directory for doing that building. Seems like gotext ought to have a better way here... |
#27898 is potentially related |
You are correct, I don't see how it will solve your problem. Alex |
Looks like a typical cross compiling situation where BUILD- and HOST-tools need to be separated. In that case, anything that builds programs to be run within the build process needs to use different variables than for programs to be run on the target system (BUILD vs HOST in GNU nomenclature). Example:
|
I maintain a Go program for Windows that uses CGo, but I mostly develop from Linux. I use gotext, which means a file has in it:
//go:generate go run golang.org/x/text/cmd/gotext -srclang=en update -out=zgotext.go -lang=en,fr,ja,sl
The problem is that in order for gotext to look at the right source files, GOOS=windows and CGO_ENABLED=1 must be set. However, that causes go run to generate executables for Windows, not my Linux host system.
I've tried variations of
-tags=windows
without GOOS being set, but that doesn't work either.Any advice?
cc @rozmansi @mpvl @bcmills
The text was updated successfully, but these errors were encountered: