Join GitHub today
cmd/go: allow replacement version to be omitted if the target module has a required version #28176
Currently you must add a version when entering a non-filesystem (remote) replacement for a module. A foolish attempt to put
However, there is already a version specification for that package in
What would be especially nice is when upgrading a package such as github.com/fsnotify/fsnotify to the future v1..4.8 version, one would not need to first run
changed the title
modules - make the trailing version optional in the replace statement in go.mod
Oct 12, 2018
Just expanding on the use case briefly:
Currently it is an error to not have a right-hand version in a
If the right-hand version in a
And then have the actual versions used could be automatically be resolved "normally" via MVS and the normal version picking rules, but hitting
That would be less fragile than something like a
I suspect that would help make modules a better upgrade for users that previously relied on glide
Perhaps the ultimate answer might end up being "use Athens", or "roll your own GOPROXY", but seems at least worth considering including this in the core go tool.
@bcmills not the most urgent question, but could you expand slightly on what you meant here:
In particular, what do you mean by a "target" there -- the left side module in the replace, or the right side module?
Going back to the first example from @dmitris above, I think this is what he was trying to say as a theoretical
Which piece of that would violate the "forbid use of one module with two different paths" restriction from the fix for #26607?
(Of course, that is not a valid
The right side module.
I'm not sure. I think I misunderstood the original report!