-
Notifications
You must be signed in to change notification settings - Fork 982
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
Use CGO_ENABLED=0 #421
Use CGO_ENABLED=0 #421
Conversation
Set `CGO_ENABLED` to 0 when building
I agree with this change, but only for I wish it was easier to find a definitive list of the drawbacks for disabling CGO for each OS. Do you know of a good reference? Do you think you could change this to only disable CGO on linux builds? |
A quick google search yields no really useful references other than "Where Go calls C". This is a bit of an interesting read. I don't have access to a windows or macOS machine to try this patch out, but perhaps instead we should test this on windows and macos to see if it's better / no worse? Using the same compiler flags for each OS is probably a good thing, especially if that 1 OS is the one most of CI runs against. Alternatively, perhaps instead specifically using |
This is in theory more stable and cross-OS than CGo
@wadey I found a simpler way. By explicitly using I think I prefer this approach? |
I just did some reviewing of the stdlib for everything using So now I'm on the side of lets just disable CGO like your original PR here, but I want to think a bit more. |
I know little about Go's internals, but yeah I do kinda prefer the cgo approach, that's also how Hugo does it. I'll leave the branch as-is for now. Think and I can revert if needed. I'm really keen to get this merged and shipped ASAP, as it'll help out a lot of platforms! |
This reverts commit 52d981d. Just use CGO_ENABLED=0
I've updated this PR to just set CGO_ENABLED=0, which I think is the better option. I have been testing with this and see no issues. |
Fixes #295
Might fix #338
Also impacts #48 and #68
Naive attempt to create statically linked binaries, suitable for dstros like Alpine. Unlike previously, binaries now execute on Alpine.
Binary still appears to execute and connect to tunnels fine on Arch.