Description
In #44550 (comment), Russ wrote:
However, we absolutely do expose the existence of v2 in other people-friendly places. There is a banner advertising v2 at the top of https://pkg.go.dev/github.com/russross/blackfriday, for example, and I think the go.mod view in VSCode Go shows a tooltip (powered by gopls) to notify about the existence of v2 as well (if not, it will soon).
In addition to the locations Russ mentioned, it would be helpful to expose the existence of a major version upgrade in 'go list -u -m all'.
I think this would help reduce toe-stubbing around major versions.
I believe this has been mentioned as a possibility in the past (e.g., #44550 (comment)), and for example discussed as part of a much broader & complex #40323, but I'm filing this short proposal because I'm not sure there is an existing issue that narrowly targets 'go list -u -m all'.
Spelling
There would need to be a decision on how it would be spelled. Bikeshedding can come later, but it could possibly use words like 'breaking' or 'major' in the output. ('incompat' or 'incompatible' I think would probably confuse people given the '+incompatible' in go.mod. 'latest' might also be best to avoid. It might be nice pick a word that hints you might need to do some work to upgrade).
So perhaps something along the lines of:
github.com/rogpeppe/go-internal v1.8.0 [v1.8.1] [v2.0.1 breaking]
But the exact spelling could come later if there is interest in the core capability.
Concerns
-
One concern expressed in the past I think was people might not like it if they see a major version listed in 'go list -u -m all' that does not get picked up by a subsequent invocation of 'go get -u'. That is a fair concern, but I think it is still a net benefit to be aware of an available major version even if the cmd/go does not automatically upgrade major versions (yet 🤞).
-
One other concern could be the stability of 'go list' output for programs that parse its output, but it is already somewhat complex and has already changed in the past. Parsing 'go list -u -m all' without using the '-json' flag is probably already a bad idea.
-
Another concern has been performance for cmd/go. Perhaps parallel requests would make it fast enough for the common case of using a GOPROXY? Also, if it helps, I think it would be reasonable to assume no vN means no need to look for a vN+1 -- in other words, no need to handle holes in the major version numbering if that helps performance at all.
Existing output
For reference, here is some sample output of go list -u -m all
today:
$ go list -u -m all
github.com/thepudds/fzgen
github.com/google/go-cmp v0.5.6 [v0.5.7]
github.com/kr/pretty v0.1.0 [v0.3.0]
github.com/kr/pty v1.1.1 [v1.1.8]
github.com/kr/text v0.1.0 [v0.2.0]
github.com/rogpeppe/go-internal v1.8.1
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f [v0.0.0-20220225172249-27dd8689420f]
Implementation
If this proposal is accepted, I would be interested in sending a CL.