Skip to content

x/website/_content/ref: inconsistent wording about version directive in go.mod #62707

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

Closed
alexbozhenko opened this issue Sep 18, 2023 · 4 comments
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@alexbozhenko
Copy link
Contributor

https://go.dev/ref/mod#go-mod-file-go says:

A go directive indicates that a module was written assuming the semantics of a given version of Go. The version must be a valid Go release version, such as 1.9, 1.14, or 1.21rc1.

https://go.dev/doc/toolchain#version says:

Released versions of Go use the version syntax ‘1.N.P’, denoting the Pth release of Go 1.N. The initial release is 1.N.0, like in ‘1.21.0’. Later releases like 1.N.9 are often referred to as patch releases.

There is no such "go release version" called 1.21.
So, according to the wording above, this is not supposed to work, right?

$ go version
go version go1.21.0 linux/amd64

$ cat main.go
package main

import "fmt"
import "runtime"

func main() {
        fmt.Println("hello from ", runtime.Version())
}
$ cat go.mod
module testing

go 1.21
$ go run main.go
hello from  go1.21.0

However, it does, effectively allowing any release in 1.21 "language version".

# updated go to 1.21.1

$ go version
go version go1.21.1 linux/amd64
$ go run main.go
hello from  go1.21.1

So should this wording be updated?

The version must be a valid Go release version, such as 1.9, 1.14, or 1.21rc1.

@gopherbot gopherbot added the Documentation Issues describing a change to documentation. label Sep 18, 2023
@seankhliao seankhliao changed the title docs: inconsistent wording about version directive in go.mod x/website/_content/ref: inconsistent wording about version directive in go.mod Sep 18, 2023
@gopherbot gopherbot added this to the Unreleased milestone Sep 18, 2023
@seankhliao
Copy link
Member

it should be updated, though 1.21 is sort of valid as it refers to the dev version

@alexbozhenko
Copy link
Contributor Author

@seankhliao
When I have go 1.21.0 installed, and go.mod specifies 1.21.1 on go run it will download 1.21.1, and run with that version.

When I have go 1.21.0 installed, and go.mod specifies 1.21, (which is pre-release dev version, according to the docs), go run will not download the dev version.
Instead, it will run with whatever go version I have, be it 1.20.0 or 1.20.1

Should specifying "language version" only, without the patch, like 1.21 be prohibited in go.mod?

@seankhliao
Copy link
Member

there is no single dev version to download, and we need a version that allows us to write code during the development cycle

@thanm thanm added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go modules labels Sep 25, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/530680 mentions this issue: _content/ref/mod: fix wording error

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Oct 2, 2023
willpoint pushed a commit to orijtech/website that referenced this issue Oct 17, 2023
The text says "Go release version" but should say "Go version".

Fixes golang/go#62707.

Change-Id: I95f6f95088cd99fdadaa57d301083d484979cdb0
Reviewed-on: https://go-review.googlesource.com/c/website/+/530680
Reviewed-by: Bryan Mills <[email protected]>
Auto-Submit: Russ Cox <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
@golang golang locked and limited conversation to collaborators Oct 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Issues describing a change to documentation. FrozenDueToAge GoCommand cmd/go modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants