-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
net: Windows build with netgo doesn't repsect hosts
file, can not resolve localhost
#57757
Comments
hosts
filehosts
file
hosts
filehosts
file, can not resolve localhost
That seems like this (CC @neild @golang/windows) |
I naively changed Everything seems to be wired up on the Windows side, only the hosts file path needs to be changed, and probably add some tests. |
The underlying problem is likely in: Lines 134 to 145 in d52883f
The result of L141 is that DNS lookups cannot check the |
Backport #22467 Fix #22370 and more. Before Go 1.19, the `netgo` tag for Windows does nothing. But Go 1.19 rewrite the net package code for Windows DNS, and there is a bug: * golang/go#57757 This PR just removes the `netgo` tag for Windows build, then the Gitea for Windows can have the old DNS behavior.
Fix #22370 and more. Before Go 1.19, the `netgo` tag for Windows does nothing. But Go 1.19 rewrite the net package code for Windows DNS, and there is a bug: * golang/go#57757 This PR just removes the `netgo` tag for Windows build, then the Gitea for Windows can have the old DNS behavior.
…iour In go1.19 there is no support for 'hosts' file for Windows: golang/go#57757 Disabling netgo will revert behaviour to go1.18 for resolving names
Change https://go.dev/cl/467335 mentions this issue: |
…iour (#352) In go1.19 there is no support for 'hosts' file for Windows: golang/go#57757 Disabling netgo will revert behaviour to go1.18 for resolving names
Seems there is an issue as noted at gocd/gocd#11398 and golang/go#57757. This reverts to the golang 1.18 behaviour for now.
golang/go#57757 i think we added netgo tag for the internalcl, since there was an issue with resolution there on linux at some point, but i guess in windows, netgo localhost resolution is broken. i just tested on my windows machine and removing netgo seems to work with both --internalcl=true and false
Change https://go.dev/cl/548095 mentions this issue: |
For #57757. For #61422. Change-Id: Icbe9a86b43eb0816dc5899a1c14b50ee22db1c5d Reviewed-on: https://go-review.googlesource.com/c/go/+/548095 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
For golang#57757. For golang#61422. Change-Id: Icbe9a86b43eb0816dc5899a1c14b50ee22db1c5d Reviewed-on: https://go-review.googlesource.com/c/go/+/548095 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
What version of Go are you using (
go version
)?What did you do?
Set Windows system DNS to a standard server which doesn't resolve
localhost
, then use Go net package to resolve a domain defined in localhosts
file (C:\Windows\System32\Drivers\etc\hosts
).What did you expect to see?
Go should respect
C:\Windows\System32\Drivers\etc\hosts
file and resolvelocalhost
correctly with-tags=netgo
.What did you see instead?
Go can not resolve localhost with
-tags=netgo
The text was updated successfully, but these errors were encountered: