-
Notifications
You must be signed in to change notification settings - Fork 26
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
Support cross-builds and cgo #26
Comments
To confirm, are you using unconvert's -all flag? |
I'm using |
According to https://github.com/alecthomas/gometalinter/blob/0262fb20957a4c2d3bb7c834a6a125ae3884a2c6/linters.go#L373, it looks like |
I see. Unconvert should support your case with the -all flag. If not, that's definitely a bug. I'm not familiar with gometalinter though. I don't know how to have it run unconvert with -all, or if that's even possible without changing the source. |
I did try running locally with the
|
You can customize the command run by {
"Linters": {
"unconvert": {"Command": "unconvert --all"}
}
} I tried
However:
The only thing different about this package seems to be the |
The problem here is that when cross-compiling, the Go build system disables cgo support by default. When cgo is disabled, files that include You can setup It's probably unlikely that you have Plan 9, Solaris, AIX, etc. cross compilers handy, however. (And assuming your code even compiles on them.) -- What I'm thinking is the best solution here is to provide more control over the set of environment variables that unconvert runs in
|
With this, users can supply a list of build configs (each specified as a list of extra key=val environment variables to set) under which to run unconvert. Unconvert will then load the packages under all configs, and use the same logic as -all to merge them. For example, on a linux/amd64 host with gcc cross-compilers for linux/386, you might use unconvert -configs='[[], ["GOARCH=386", "CGO_ENABLED=1", "CC_FOR_TARGET=gcc -m32"]]' mypkgs... to test both the native build and linux/386 build with cgo support. Updates #26.
I added support at master for a Open questions:
|
I'm using the |
The type of
syscall.Stdin
differs on Linux (int
) and Windows (syscall.Handle
). As such, any calling code needs to always castsyscall.Stdin
to an integer to use it. But this gets flagged byunconvert
on Linux.My current workaround is to do
int(os.Stdin.Fd())
instead ofsyscall.Stdin
. Would be nice to do without the hack.The text was updated successfully, but these errors were encountered: