hack/make/.binary: don't use "netgo" when building Windows binaries#45603
Merged
thaJeztah merged 1 commit intomoby:masterfrom May 24, 2023
Merged
hack/make/.binary: don't use "netgo" when building Windows binaries#45603thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah merged 1 commit intomoby:masterfrom
Conversation
3eb48d7 to
e2173df
Compare
Member
|
The first version of this PR didn't successfully disable the buildtag; I have updated the PR to do so. |
thaJeztah
commented
May 24, 2023
Member
Author
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM on fixing up :)
crazy-max
approved these changes
May 24, 2023
Member
Author
|
We may still update the comment to link to the Golang issue about |
e2173df to
cbf6134
Compare
Starting with go1.19, the Go runtime on Windows now supports the `netgo` build- flag to use a native Go DNS resolver. Prior to that version, the build-flag only had an effect on non-Windows platforms. When using the `netgo` build-flag, the Windows's host resolver is not used, and as a result, custom entries in `etc/hosts` are ignored, which is a change in behavior from binaries compiled with older versions of the Go runtime. From the go1.19 release notes: https://go.dev/doc/go1.19#net > Resolver.PreferGo is now implemented on Windows and Plan 9. It previously > only worked on Unix platforms. Combined with Dialer.Resolver and Resolver.Dial, > it's now possible to write portable programs and be in control of all DNS name > lookups when dialing. > > The net package now has initial support for the netgo build tag on Windows. > When used, the package uses the Go DNS client (as used by Resolver.PreferGo) > instead of asking Windows for DNS results. The upstream DNS server it discovers > from Windows may not yet be correct with complex system network configurations, > however. Our Windows binaries are compiled with the "static" (`make/binary-daemon`) script, which has the `netgo` option set by default. This patch unsets the `netgo` option when cross-compiling for Windows. Co-authored-by: Bjorn Neergaard <[email protected]> Signed-off-by: Bjorn Neergaard <[email protected]>
cbf6134 to
53d1b12
Compare
neersighted
approved these changes
May 24, 2023
Member
neersighted
left a comment
There was a problem hiding this comment.
Applying @thaJeztah's LGTM 🙈
vvoland
approved these changes
May 24, 2023
Member
Author
|
All green; let's bring this one in |
This was referenced May 24, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Starting with go1.19, the Go runtime on Windows now supports the
netgobuild- flag to use a native Go DNS resolver. Prior to that version, the build-flag only had an effect on non-Windows platforms. When using thenetgobuild-flag, the Windows's host resolver is not used, and as a result, custom entries inetc/hostsare ignored, which is a change in behavior from binaries compiled with older versions of the Go runtime.From the go1.19 release notes: https://go.dev/doc/go1.19#net
Our Windows binaries are compiled with the "static" (
make/binary-daemon) script, which has thenetgooption set by default. This patch unsets thenetgooption when cross-compiling for Windows.- What I did
- How I did it
- How to verify it
- Description for the changelog
hostsfile and other components of the native DNS stack on Windows.- A picture of a cute animal (not mandatory but encouraged)