-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
invalid version: module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2 #35732
Comments
The error message is correct. See https://golang.org/cmd/go/#hdr-Module_compatibility_and_semantic_versioning. The From the perspective of the |
Hi masters, how to solve this? it's under google... |
@wrfly, use the import path declared in the |
Okay, thank you very much, master! |
yikes, this is not great UX, I hope the Go authors will reconsider some of these choices, or at least improve the error message |
So I've been just bitten by this:
While: https://github.com/zeromq/goczmq/blob/master/go.mod has
But I still get:
While: go: github.com/zeromq/goczmq upgrade => v4.1.0+incompatible gives me |
@bcmills Could you explain again why running I would expect that A concrete example. I am trying to download Getting the specific version fails.
Getting the major version failsSee go.mod.
Getting without a version gets the wrong version
Workaround from the
|
@dzrtc, see:
|
+1 |
Also hitting this in go-sqlite3: mattn/go-sqlite3#812 |
golang/go#35732 It looks like our install instructions fall into this [pseudo-version](https://golang.org/cmd/go/#hdr-Pseudo_versions) trap mentioned in the above issue. This adds the `v3` scope to the url and it updated the bump script to make sure that the number stays up to date.
golang/go#35732 It looks like our install instructions fall into this [pseudo-version](https://golang.org/cmd/go/#hdr-Pseudo_versions) trap mentioned in the above issue. This adds the `v3` scope to the url and it updated the bump script to make sure that the number stays up to date.
I wanna use the latest version of
Here is my solution: import "github.com/tealeg/xlsx/v3" then
|
This is battle between Golang authors and Prometheus authors (probably some others as well). Golang requires semantic versioning, and Prometheus doesn't want submit to those rules: * With Go 1.13 can no longer flag versions as incompatible, if the have a 'go.mod' file in their repository: golang/go#35732 * Dropping the '+incompatible' suffix is not possible, because the module author (Prometheus) would need to add the suffix '/v2' to their module. Otherwise you run into: golang/go#35732 (comment) * Prometheus doesn't care about Golang's idea of versioning and simply ignores it: prometheus/prometheus#6048 (comment) You can still put a commit has into the go.mod file as version, but that gets translated to into a version from the past (for 2.15.2 prometheus this will resolve into 2.3.x or 1.8.x). The solution to all of this insanity is, to declare the version you had in mind in the "requires" section. And then add a mapping entry into the "replace" section, pointing to the actual version, using a commit hash and the "v0.0.0" version.
This is battle between Golang authors and Prometheus authors (probably some others as well). Golang requires semantic versioning, and Prometheus doesn't want submit to those rules: * With Go 1.13 can no longer flag versions as incompatible, if the have a 'go.mod' file in their repository: golang/go#35732 * Dropping the '+incompatible' suffix is not possible, because the module author (Prometheus) would need to add the suffix '/v2' to their module. Otherwise you run into: golang/go#35732 (comment) * Prometheus doesn't care about Golang's idea of versioning and simply ignores it: prometheus/prometheus#6048 (comment) You can still put a commit has into the go.mod file as version, but that gets translated to into a version from the past (for 2.15.2 prometheus this will resolve into 2.3.x or 1.8.x). The solution to all of this insanity is, to declare the version you had in mind in the "requires" section. And then add a mapping entry into the "replace" section, pointing to the actual version, using a commit hash and the "v0.0.0" version.
This is battle between Golang authors and Prometheus authors (probably some others as well). Golang requires semantic versioning, and Prometheus doesn't want submit to those rules: * With Go 1.13 can no longer flag versions as incompatible, if the have a 'go.mod' file in their repository: golang/go#35732 * Dropping the '+incompatible' suffix is not possible, because the module author (Prometheus) would need to add the suffix '/v2' to their module. Otherwise you run into: golang/go#35732 (comment) * Prometheus doesn't care about Golang's idea of versioning and simply ignores it: prometheus/prometheus#6048 (comment) You can still put a commit has into the go.mod file as version, but that gets translated to into a version from the past (for 2.15.2 prometheus this will resolve into 2.3.x or 1.8.x). The solution to all of this insanity is, to declare the version you had in mind in the "requires" section. And then add a mapping entry into the "replace" section, pointing to the actual version, using a commit hash and the "v0.0.0" version.
This is battle between Golang authors and Prometheus authors (probably some others as well). Golang requires semantic versioning, and Prometheus doesn't want submit to those rules: * With Go 1.13 can no longer flag versions as incompatible, if the have a 'go.mod' file in their repository: golang/go#35732 * Dropping the '+incompatible' suffix is not possible, because the module author (Prometheus) would need to add the suffix '/v2' to their module. Otherwise you run into: golang/go#35732 (comment) * Prometheus doesn't care about Golang's idea of versioning and simply ignores it: prometheus/prometheus#6048 (comment) You can still put a commit has into the go.mod file as version, but that gets translated to into a version from the past (for 2.15.2 prometheus this will resolve into 2.3.x or 1.8.x). The solution to all of this insanity is, to declare the version you had in mind in the "requires" section. And then add a mapping entry into the "replace" section, pointing to the actual version, using a commit hash and the "v0.0.0" version.
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 |
We are not allowed to remove any trailing version path: * golang/go#35732 From the official go docs: * https://golang.org/cmd/go/#hdr-Module_compatibility_and_semantic_versioning > In semantic versioning, changing the major version number indicates a lack of backwards compatibility with earlier versions. To preserve import compatibility, the go command requires that modules with major version v2 or later use a module path with that major version as the final element. For example, version v2.0.0 of example.com/m must instead use module path example.com/m/v2, and packages in that module would use that path as their import path prefix, as in example.com/m/v2/sub/pkg. Including the major version number in the module path and import paths in this way is called "semantic import versioning". Pseudo-versions for modules with major version v2 and later begin with that major version instead of v0, as in v2.0.0-20180326061214-4fc5987536ef.
The problem with the error is that it doesn't point the user toward the solution: add major version to import path. This is by no means a good error message, but it contains actionable information.
|
@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)! |
Since we are releasing as v2 the module path has to follow this pattern See: - golang/go#35732 - https://golang.org/cmd/go/#hdr-Module_compatibility_and_semantic_versioning
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Correctly download this module.
What did you see instead?
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 issuebut on
go.mod
, the version be taged withv1.9.1-0.20191114083447-dde9fc9f35b8
, it is ambiguous . the module not contain versionv1.9.1
. How i to solve this ?The text was updated successfully, but these errors were encountered: