-
Notifications
You must be signed in to change notification settings - Fork 17.4k
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
cmd/go: support both .netrc and _netrc under windows #66832
Comments
Change https://go.dev/cl/587997 mentions this issue: |
Hi, looking at this again, it seems like the standard on Windows is to call the file |
Maybe @bagder remembers why curl does it this way. Is that legacy support for an early programming mistake when doing the windows port? What happens if both files exist and contradict each other? |
curl supports .netrc is unfortunately really bad in general for cross-tool use since there is no defined syntax and tools and libraries treat it differently, making detection of it the same way across tools actually being less important. |
Go version
go version go1.22.1 windows/amd64
Output of
go env
in your module/workspace:What did you do?
I have
%USERPROFILE%\.netrc
with proper credentials, and then:What did you see happen?
What did you expect to see?
Download succeeds. It works if I copy:
%USERPROFILE%\.netrc
to
%USERPROFILE%\_netrc
Code in go expects
_netrc
:go/src/cmd/go/internal/auth/netrc.go
Line 90 in fa98f46
While e.g.
curl
library (used by e.g. git and other tools) reads first.netrc
file and fallbacks to_netc
if not found:https://github.com/curl/curl/blob/49f83c30e43749752072c65a43d553eb015453d1/docs/cmdline-opts/netrc.md?plain=1#L28
This functionality was added in curl/curl@f9c7ba9
Found issue when adding go support to some tooling, everything else was working but not go.
There seem to be no one convention how those files should be named (e.g. bazel seems to look only for
.netrc
- code), but probably being compatible with curl way is most appropriate.For reference, issue on go that lead to adding support of _netrc under windows: #24606
The text was updated successfully, but these errors were encountered: