go: invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2
What version of Go are you using (go version
)?
$ go version go version go1.13.1 darwin/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/Users/xxx/Library/Caches/go-build" GOENV="/Users/xxx/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/xxx/go" GOPROXY="direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/xxx/workspace/test/apollo/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/kc/jryd_rpn6_l03ykk8q84d6740000gp/T/go-build000733542=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
go get github.com/zouyx/agollo@v2.2.1
What did you expect to see?
Correctly download this module.
What did you see instead?
invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2
I import the thirdparty module. The module has the latest version v2.2.1
. A project is developing , but go forbid me to get the latest version to continue develop my project,Because the module not compatible with sematic import versioning. Through, I found a way to solve this issue
go get github.com/zouyx/agollo@master
but on go.mod
, the version be taged with v1.9.1-0.20191114083447-dde9fc9f35b8
, it is ambiguous . the module not contain version v1.9.1
. How i to solve this ?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (6 by maintainers)
Links to this issue
Commits related to this issue
- Add version scoped url https://github.com/golang/go/issues/35732 It looks like our install instructions fall into this [pseudo-version](https://golang.org/cmd/go/#hdr-Pseudo_versions) trap mentioned... — committed to recurly/recurly-client-go by bhelx 4 years ago
- Add version scoped url https://github.com/golang/go/issues/35732 It looks like our install instructions fall into this [pseudo-version](https://golang.org/cmd/go/#hdr-Pseudo_versions) trap mentioned... — committed to recurly/recurly-client-go by bhelx 4 years ago
- Fix dependency declaration of Prometheus - I ❤️ Cargo and Rust so much! This is battle between Golang authors and Prometheus authors (probably some others as well). Golang requires semantic versioni... — committed to ctron/enmasse by ctron 4 years ago
- Fix dependency declaration of Prometheus - I ❤️ Cargo and Rust so much! This is battle between Golang authors and Prometheus authors (probably some others as well). Golang requires semantic versioni... — committed to ctron/enmasse by ctron 4 years ago
- Fix dependency declaration of Prometheus This is battle between Golang authors and Prometheus authors (probably some others as well). Golang requires semantic versioning, and Prometheus doesn't want... — committed to ctron/enmasse by ctron 4 years ago
- Fix dependency declaration of Prometheus (#4699) This is battle between Golang authors and Prometheus authors (probably some others as well). Golang requires semantic versioning, and Prometheus d... — committed to EnMasseProject/enmasse by ctron 4 years ago
- Fix go.mod https://github.com/golang/go/issues/35732 — committed to kyokomi/emoji by kyokomi 4 years ago
- Fix go.mod https://github.com/golang/go/issues/35732 — committed to kyokomi/emoji by kyokomi 4 years ago
- Fix go.mod https://github.com/golang/go/issues/35732 — committed to kyokomi/emoji by kyokomi 4 years ago
- Fix go.mod (#46) https://github.com/golang/go/issues/35732 — committed to kyokomi/emoji by kyokomi 4 years ago
- Fix bug causing output of incorrect path We are not allowed to remove any trailing version path: * https://github.com/golang/go/issues/35732 From the official go docs: * https://golang.org/cmd/go/... — committed to JoakimSoderberg/gobindep by JoakimSoderberg 4 years ago
- Fix module version path Since we are releasing as v2 the module path has to follow this pattern See: - https://github.com/golang/go/issues/35732 - https://golang.org/cmd/go/#hdr-Module_compatibility... — committed to trendmicro/new-release-version by zachwhaley 4 years ago
The error message is correct. See https://golang.org/cmd/go/#hdr-Module_compatibility_and_semantic_versioning.
The
v1.9.1-0.[…]
version string is a pseudo-version generated from the requested commit.From the perspective of the
go
command, this is working as designed.yikes, this is not great UX, I hope the Go authors will reconsider some of these choices, or at least improve the error message
Issue should be opened until the error message is made more clear. Users shouldn’t have to Google an error message to find out what it means. Take some notes from Rust and
cargo
.@icholy and @m-cat, this issue is closed, and the issue as originally reported was a failure to download the module, not the wording of the resulting error message.
That said, we do want to make the errors as clear as possible. If you have a specific improvement to suggest in the phrasing of the error, please open a new issue (or send a change with the proposed improvement)!
@wrfly, use the import path declared in the
go.mod
file:github.com/google/go-github/v29
, notgithub.com/google/go-github
.So I’ve been just bitten by this:
While: https://github.com/zeromq/goczmq/blob/master/go.mod has
But I still get:
While:
gives me
v4.1.0
which is an older release (and marks it as incompatible ? )Sorry to be snarky, but cmake solved this long long ago
I wanna use the latest version of
github.com/tealeg/xlsx
in my project.go get -u github.com/tealeg/xlsx
doesn’t work andgo get github.com/tealeg/xlsx@3.0.0
occurs an error as follows:Here is my solution:
then
go mod tidy
. Eventually,go.mod
requires the latest version:@bcmills Can you investigate more? I can still report errors
docker run -it golang:sha256:cbd5e567cfb8a2119d231039809fbdbcc0d2dc9436d150da422a52ad550fb9b2
go get -u github.com/boyter/scc/v2
- returns weird “can only find 2.12.0+incompatible” I cannot in any way write a go get command that downloads boyter/scc@v2.13.0go get -u github.com/boyter/scc@v2
downloads v2.12.0+incompatible (aftergo mod init <anything>
)the workaraound for me was
git clone --branch v2.13.0 --depth 1 https://github.com/boyter/scc
thengo build
but it doesn’t really seem to work properly (but that is probably on my part)So I would argue that the error is there! There IS a failure to download the module (at the given version)
Hi masters, how to solve this? it’s under google…