Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: do not pick obsolete v1 in automatic import selection #26238
It's not OK that vgo selects the latest v1 when there is a v2 or later not written using semantic import versioning that has replaced the v1. Typically such an import is expecting the latest tag, not the last v1 (or v0).
Examples include github.com/coreos/etcd and k8s.io/client-go.
This was referenced
Jul 6, 2018
referenced this issue
Jul 10, 2018
Is there a proposed solution for this already?
If not, what if vgo looks at the latest tag, and takes the commit the latest tag is at and then writes a
The tricky part is how to detect when a major version switches from non-semantic import paths to semantic ones: if the repository is tagged
But the key insight, I think, is that if the unversioned import path ever meant
There is no reason to change the import path at that point, because the damage is already done. In fact, changing to a versioned import path would imply that there is no longer a single canonical import path for that package. The package maintainers are free to bump the major version again when they're ready to switch to a semantic import path, but we shouldn't try to push them to a new path when it doesn't break compatibility with up-to-date existing code.