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

Comments

Projects
None yet
5 participants
@neild
Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

commented Feb 1, 2019

@gopherbot

This comment has been minimized.

Copy link

commented Feb 1, 2019

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

@gopherbot gopherbot closed this in 03a9f5a Feb 1, 2019

nebulabox added a commit to nebulabox/go that referenced this issue Feb 18, 2019

doc: go1.12: update notes on go directive
Fixes golang#30043

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

nebulabox added a commit to nebulabox/go that referenced this issue Feb 20, 2019

doc: go1.12: update notes on go directive
Fixes golang#30043

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

This comment has been minimized.

Copy link

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 join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.