go: cmd/go: "module requires Go 1.12" error when building with Go 1.11.3 or earlier
What version of Go are you using (go version
)?
Downloading: https://storage.googleapis.com/golang/go1.11.linux-amd64.tar.gz Extracting archive [command]/bin/tar xzC /home/vsts/work/_temp/1c8530c4-eae3-4887-a554-cae13254c039 -f /home/vsts/work/_temp/86ea4780-4861-4208-9eee-76c050c1dcec Caching tool: go 1.11.0 x64 Prepending PATH environment variable with directory: /opt/hostedtoolcache/go/1.11.0/x64/bin
Does this issue reproduce with the latest release?
No
What operating system and processor architecture are you using (go env
)?
go env
Output
go1.11.linux-amd64 https://dev.azure.com/markbates/buffalo/_build/results?buildId=412
What did you do?
I rebuilt the go.mod
file for gobuffalo/buffalo
(https://github.com/gobuffalo/buffalo/pull/1610/files) using go1.12
. In doing so it added go 1.12
to the top of the go.mod
:
module github.com/gobuffalo/buffalo
go 1.12
When attempting to test this on CI with any variation of GOOS (windows, Mac, linux), go1.11
and GO111MODULES=on
, I get errors telling me that module requires Go 1.12
PR: https://github.com/gobuffalo/buffalo/pull/1610/files CI: https://dev.azure.com/markbates/buffalo/_build/results?buildId=412
What did you expect to see?
I expected my tests to pass as they had previously done before the go.mod
file was modified.
What did you see instead?
go build github.com/gobuffalo/buffalo/render: module requires Go 1.12
go build github.com/gobuffalo/buffalo/binding: module requires Go 1.12
go build github.com/gobuffalo/buffalo/runtime: module requires Go 1.12
go build github.com/gobuffalo/buffalo/servers: module requires Go 1.12
go build github.com/gobuffalo/buffalo/worker: module requires Go 1.12
go build github.com/gobuffalo/buffalo/binding: module requires Go 1.12
go build github.com/gobuffalo/buffalo/buffalo/cmd/destroy: module requires Go 1.12
go build github.com/gobuffalo/buffalo/packrd: module requires Go 1.12
go build github.com/gobuffalo/buffalo/genny/grift: module requires Go 1.12
go build github.com/gobuffalo/buffalo/genny/grift: module requires Go 1.12
go build github.com/gobuffalo/buffalo/grifts: module requires Go 1.12
go build github.com/gobuffalo/buffalo/mail/internal/mail: module requires Go 1.12
go build github.com/gobuffalo/buffalo/render: module requires Go 1.12
go build github.com/gobuffalo/buffalo/worker: module requires Go 1.12
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- doc/go1.12: new go line in go.mod can break builds with Go 1.11 - 1.11.3 Fixes #30446 Change-Id: If069f72fa9735f839df92f3ede3bf7b6d7a695a5 Reviewed-on: https://go-review.googlesource.com/c/164317 Re... — committed to golang/go by ianlancetaylor 5 years ago
- [release-branch.go1.12] doc/go1.12: new go line in go.mod can break builds with Go 1.11 - 1.11.3 Updates #30446 Change-Id: If069f72fa9735f839df92f3ede3bf7b6d7a695a5 Reviewed-on: https://go-review.go... — committed to golang/go by ianlancetaylor 5 years ago
- go.mod: add 'go 1.11' line This is the recommendation at https://github.com/golang/go/issues/30446 Otherwise 'go 1.12' gets added automatically by the go tool from 1.12 toolchain, which makes it inc... — committed to google/periph by maruel 5 years ago
- Adopting Go 1.12 This is to work around https://github.com/golang/go/issues/30446 — committed to marstr/baronial by marstr 5 years ago
- Adopting Go 1.12 This is to work around https://github.com/golang/go/issues/30446 — committed to marstr/baronial by marstr 5 years ago
- all: change package manager from dep to go mod (#1542) Converts the mono repo from using the `dep` package manager to using the [go mod](https://github.com/golang/go/wiki/Modules) that has become the... — committed to stellar/go by leighmcculloch 5 years ago
I think the issue is the meaning of the
go
directive changed, and that change was first introduced in 1.11.4 and 1.12.I believe Go 1.11.4 and higher will build a module that contains version
go 1.12
without complaint, whereas earlier 1.11 versions complain withgo build github.com/me/hello: module requires Go 1.12
.https://golang.org/doc/go1.12#modules states the following:
Wouldn’t that apply in this case, meaning it should still compile with 1.11 in this case?
Here’s a short end-to-end example showing 1.11.3 fail and 1.11.4 build succesfully.
I don’t particularly want to hack the Go 1.12 go language. I sent https://golang.org/cl/164317 to update the release notes.
What people say above is correct: when creating a module with Go 1.12, and thereby getting a
go 1.12
in your go.mod file, you need to use at least Go 1.11.4 to build the module going forward. Closing because this is working as expected. I agree that this is imperfect but the only other option I see would be to delay all language changes for another six months, which seems severe.