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.
Fix go-gitea#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.
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: