Go version
1.22.1
What did you do?
I'm trying to compile a project. And I want to use github.com/quic-go/quic-go v0.40.1 The compiler tells me that I can't use this version and I have to update it to at least 0.43.0 I don't need that. And I want to use 0.40.1 version.
Why does the program dictate to me what version I should use????
Comment From: ianlancetaylor
We don't use GitHub for discussions or questions. Please use a forum instead. See https://go.dev/wiki/Questions. Thanks.
If you are absolutely certain that this is a bug, you will need to explain how to reproduce the problem. We won't be able to do anything without that sort of information.
Comment From: master255
@ianlancetaylor This is not a discussion. To reproduce the bug install the version: github.com/quic-go/quic-go v0.40.1 in go.mod Then try to synchronize the project. Synchronization will automatically update the version to 0.44.0
But I need 0.40.1
Comment From: randall77
I am able to build a project which imports quic-go at version v0.40.1 with no trouble.
We'll need more info. "the project" = what project, exactly? Something might depend on other entries in your go.mod, or some source file. "try to synchronize" = what is that, exactly? "go mod tidy", or something else? What exact command did you run? How do you know the version is updated? Did it change in the go.mod file, or are you seeing this version change some other way?
Comment From: master255
@randall77 Project - gomobile Command for synchronization: go mod tidy or go get golang.org/x/mobile/bind
How do you know the version is updated?
I see it in go.mod
Comment From: master255
https://github.com/golang/go/assets/5380115/bcdc0e81-7ad4-4e11-aab7-97d98e8794fc
I literally can't do anything. Even in Goland.
Comment From: randall77
git clone https://github.com/golang/mobile
cd mobile
go mod tidy
grep quic go.mod
Returns no result. What am I missing?
Comment From: master255
@randall77 Okay. Use the project https://github.com/libp2p/go-libp2p
Comment From: master255
And I can't not update the version on the command line and in Goland. So the problem is in Go.
Comment From: randall77
go mod graph
(https://go.dev/ref/mod#go-mod-graph) reports this edge:
github.com/quic-go/webtransport-go@v0.8.0 github.com/quic-go/quic-go@v0.43.0
Sure enough, 0.43.0 is required by that module. https://github.com/quic-go/webtransport-go/blob/master/go.mod Which was bumped by that project at https://github.com/quic-go/webtransport-go/pull/150 less than 2 months ago.
Your require
line is a minimum version spec. Any of your dependencies can require a later version, and Go will pick the minimum version that satisfies everyone (https://research.swtch.com/vgo-mvs).
Comment From: randall77
If you really want to use an earlier version of quic-go
, you'll also need an earlier (or modified) version of webtransport-go
.
Comment From: master255
@randall77 Okay. Thank you! But there has to be some kind of message here, I think. From the programmer's side, it seems that Go dictates the version to be used. And it's very time-consuming. Something needs to be done about it.
Comment From: randall77
From the programmer's side, it seems that Go dictates the version to be used.
Go is not doing the dictating. Your dependencies are doing the dictating.
Something needs to be done about it.
We're open to suggestions. I think changing the selection algorithm is out of the question, but possibly there could be a tool (maybe a mode of go mod tidy?) that describes why it is picking that version. It was pretty easy for me to do that with go mod graph
and grep
.
Comment From: master255
@randall77 It is necessary to display the message in the command: go mod tidy If the version of one component has been updated because of another component.
Comment From: master255
@randall77 Or at least some kind of go mod tidy mode that will display a log of its work.
Comment From: master255
Otherwise, the programming looks very strange https://github.com/golang/go/issues/68076#issuecomment-2179498413
Comment From: seankhliao
The go
command reports:
$ go build
go: updates to go.mod needed; to update it:
go mod tidy
For what you're experiencing, I think that should be a bug report to GoLand for better feedback on changing to incompatible versions.
Comment From: seankhliao
If you actually used the command line to use the lower version, it would have performed all the necessary downgrades for you:
$ go get github.com/quic-go/quic-go@v0.41.0
go: downloading github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
go: downloading github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5
go: downloading golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
go: downloading github.com/quic-go/webtransport-go v0.6.0
go: downgraded github.com/quic-go/quic-go v0.43.0 => v0.41.0
go: downgraded github.com/quic-go/webtransport-go v0.8.0 => v0.6.0
Comment From: master255
@seankhliao
If you actually used the command line to use the lower version, it would have performed all the necessary downgrades for you:
This is too complicated for Android programmer. And I use gomobile, which recommends me to use : go get golang.org/x/mobile/bind to synchronize components. I do that and the version is up. But how to get the version that was there before the automatic upgrade is not written anywhere. And I didn't know it was even possible to start searching. There is something that needs to be fixed. Make sure that Goland does not ask for additional fixes later.