Skip to content
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

x/any: make the netrc parser importable #31334

Open
kevinburke opened this issue Apr 8, 2019 · 3 comments

Comments

@kevinburke
Copy link
Contributor

commented Apr 8, 2019

There are two implementations of a netrc parser: one lives in src/cmd/go/internal/web2/web.go and the other one lives in x/tools/cmd/auth/netrcauth/netrcauth.go.

Apart from the fact that these two implementations may differ in how they parse the spec this is a useful piece of functionality written by people with a high degree of trust and it would be nice if this library could be imported from somewhere.

@bcmills

This comment has been minimized.

Copy link
Member

commented Apr 9, 2019

CC @rogpeppe for github.com/rogpeppe/go-internal.

Note that the netrc parser is currently in flux for #26232.

Honestly, though, if you need to consume its output I would rather you just shell out to x/tools/cmd/auth/netrcauth: that command-line API will need to be stable by 1.13, and it's very easy to parse using textproto, so I'm not sure we need to add a Go package API on top of it.

@josharian

This comment has been minimized.

Copy link
Contributor

commented Apr 9, 2019

Aside: Possibly a good candidate for fuzzing. cc @thepudds

@kevinburke

This comment has been minimized.

Copy link
Contributor Author

commented Apr 13, 2019

Alright, I might push a proposed interface to github.com/kevinburke/netrc and we can see how it looks.

netrcauth seems like it would do what I want, but the goal would be to use it in API clients such as github.com/kevinburke/twilio-go or github.com/kevinburke/travis and I'm not sure I want to count on end users having a second binary - netrcauth - on their machines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.