-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: cmd/go: allow GOPRIVATE, GONOSUMDB, GONOPROXY to be defined in go.mod #48441
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
Comments
Related #33985 |
This seems like a duplicate of #42343. #39005 and #43288 are also pretty close. I think we should close this unless there's new information about why this is different. In particular, @rsc's comment is relevant:
A couple other thoughts:
|
Hi there @jayconrod! Thank you so much for taking your time to review this!
I see. That's a very specific point, and I'm afraid I don't have enough property to discuss this at all; it's for sure best for other contributors to express their opinion on this matter, just like you did. It would be awesome if this could be covered by #45713 or any other proposal, if that's the case feel free to close this. <3 |
This proposal is a duplicate of a previously discussed proposal, as noted above, |
Background
It is not uncommon for companies to host Go libraries as private repositories, and even provide vanity URLs that redirect to specific directories in a private repository; Go already provides ways for dealing with those private repositories by using the
GOPRIVATE
,GONOSUMDB
, andGONOPROXY
environments, which requires users to export those environments and/or configure their tooling appropriately to handle those exceptions.I have seen an array of different solutions for those cases, which ranges from repositories providing wrappers for
go mod
andgo build
by exporting the aforementioned environment variables before invoking the command, to requiring plugins for handling.env
files containing the necessary set of environments for handling projects with private dependencies.Solution
I believe Go can provide a far better developer experience by leveraging
go.mod
, which could (a) allow private repositories to be provided in aprivate
,nosum
, andnoproxy
blocks, or (b) allow private/nosum/noproxy dependencies to be marked as so through a comment, just likeindirect
does.Option A: Augmenting
go.mod
with blocksJust like
require
, one would be able to provide URLs that will be interpreted just like when passed to their related environment variables:Extra blocks such as
nosum
andnoproxy
could also be allowed, and all blocks provide the same behaviour as when setting environment variables:Option B: Leveraging comments like
indirect
The same is already done with the
indirect
comment, but instead of implementing a new block type, a single comment may be placed on every private (nosumdb + noproxy) dependency:The text was updated successfully, but these errors were encountered: