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: better versioning support for go get
#13700
Comments
Probably you should recast this in the form of a proposal (https://github.com/golang/proposal). The proposal should explain exactly what should happen if package A imports packages B and C, and B imports D#v1 and C imports D#v2. |
go get
go get
Is there a standard format of a proposal I should be aware of? Are there any examples I can reference? Also more broadly, in the go compiler is there a distinction made between packages nested within the package being compiled and packages from external sources? |
For existing proposals, please see
https://github.com/golang/proposal/tree/master/design.
(I wouldn't worry too much about the format though,
the design question Ian mentioned is much harder to
solve than it appears.)
The Go compiler only compiles one package at a time,
and all the source code must be local. Use "go build -x"
to learn more about the compilation process.
|
Thanks, I'll take a look! |
I know its been a while since I asked this question, but I would still like to see this addition. @minux You seem to be more knowledgeable about the compile time problems. To the question @ianlancetaylor originally proposed:
the source tree would look like this:
First D#v2 and D#v1 would be compiled, then they would be linked to C and B, respectively, which would then be compiled and linked to A, which would then be compiled. This seems like a relatively simple solution to the problem. A utility could be written to detect imports of different versions of the same package independent of the build or compile process. It would be up to package authors to use this utility at their own discretion. We could use notation similar to semver for the version numbers. Whenever This seems like it would completely solve all of go's versioning problems with minimal overhead. Am I missing something that would make this a very complicated or undesirable change? |
What you are proposing is that |
Fixed by modules, closing. |
In my experience the lack of officially supported, built in, version control is the biggest pain point of the go language. This is a feature that a modern language, a language being built today in front of an active community of its users, should at least aspire to do well.
The Feature Request
I would like to see native support for version control built in to the
go get
utility. The syntax could look something like this:go get
would function exactly as it currently does except that after a repo is cloned, it would check out the branch specified after the#
.For simplicities sake, you could add the following implementation details:
$GOPATH/src
the directory structure could contain the package name with the tag appended to it. I think this will make the changes needed to implement this feature fairly minimal.Common Objections
I'm aware that the members of the core team are fans of the stable head methodology and that you would rather not needlessly complicate the logic of the
go get
utility. However, many people (myself included) have found some kind of versioning support very useful to the point where there are several competing package management solutions that I'm sure you have seen. I'm also aware that the team has added the vendor directory for experimental use. None of these solutions feel like real solutions to the problem. There is already an official dependency manager, it should support versioning.Is there any chance that something like this could be put on the roadmap? Thanks!
The text was updated successfully, but these errors were encountered: