Skip to content
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

cmd/go: "go mod tidy" is not the only subcommand to add "go 1.12" to go.mod #30043

Closed
neild opened this issue Jan 31, 2019 · 3 comments
Closed

Comments

@neild
Copy link
Contributor

neild commented Jan 31, 2019

The 1.12 release notes say:

The go directive in a go.mod file now indicates the version of the language used by the files within that module, and go mod tidy sets it to the current release (go 1.12) if no existing version is present.

The version is not just being added by go mod tidy, but also go build and go test.

$ echo "module github.com/neild/foo" > go.mod
$ echo "package foo" > foo.go
$ go test .
?       github.com/neild/foo    [no test files]
$ cat go.mod
module github.com/neild/foo

go 1.12

I don't know if the relnotes or the behavior is in error.

@mvdan mvdan added this to the Go1.12 milestone Feb 1, 2019
@mvdan
Copy link
Member

mvdan commented Feb 1, 2019

/cc @bcmills @ianlancetaylor

@gopherbot
Copy link

Change https://golang.org/cl/160797 mentions this issue: doc: go1.12: update notes on go directive

nebulabox pushed a commit to nebulabox/go that referenced this issue Feb 18, 2019
Fixes golang#30043

Change-Id: I4ecfff7d8a9432240c1927f7484786fe1182b773
Reviewed-on: https://go-review.googlesource.com/c/160797
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
nebulabox pushed a commit to nebulabox/go that referenced this issue Feb 20, 2019
Fixes golang#30043

Change-Id: I4ecfff7d8a9432240c1927f7484786fe1182b773
Reviewed-on: https://go-review.googlesource.com/c/160797
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@thepudds
Copy link
Contributor

thepudds commented Feb 26, 2019

I know this is closed, but FWIW, it is not obvious to me what triggers adding a missing go version directive. go mod init adds it. Things like go build and go mod tidy do not seem to add a missing go version directive, with seemingly the exception if you do not have any require statements then go build or go mod tidy seem to add a missing go version directive.

The draft 1.12 release notes used to say go mod tidy is what would trigger adding a missing go version directive, but that was seemingly removed in the final version of the release notes:

https://go-review.googlesource.com/c/go/+/160797/2/doc/go1.12.html

CC @gilcrest

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants