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

Defaults to v1.11.x version, despite "go 1.12" in go.mod file #301

Closed
msiebuhr opened this issue Mar 8, 2019 · 11 comments
Closed

Defaults to v1.11.x version, despite "go 1.12" in go.mod file #301

msiebuhr opened this issue Mar 8, 2019 · 11 comments

Comments

@msiebuhr
Copy link

msiebuhr commented Mar 8, 2019

When building, I get this message:

 !!    The go.mod file for this project does not specify a Go version
 !!    
 !!    Defaulting to go1.11.5
 !!    
 !!    For more details see: https://devcenter.heroku.com/articles/go-apps-with-modules#build-configuration
 !!    

Despite go.mod having the line go 1.12 in it.

Having to specify the same thing twice is a little weird to me.

@freeformz
Copy link
Contributor

Our support for go modules predates the go tooling adding the go X.Y directive.

ATM, you will need to add a line like the following to get go1.12:

// +heroku goVersion go1.12

@jmorrell
Copy link
Contributor

jmorrell commented Mar 8, 2019

We are working to get support for the go version directive out soon

@heroku heroku deleted a comment from jparcus34 Mar 21, 2019
@heroku heroku deleted a comment from jparcus34 Mar 21, 2019
@freeformz
Copy link
Contributor

A discussion on go-nuts started by @sowjumn indicates that the go directive in the go.mod file shouldn't be used for version selection. It's meant to indicate the version of the language features that are required by the code base. For example, if a breaking change were introduced in go1.13 a go 1.12 directive would in theory allow for the code base to be compiled with go1.13, but using go1.12's feature set. I'm unsure how the language maintainers are going to pull this off over time given each new version with incompatible changes adds to their maintenance complexity. Maybe they'll only support the previous version (go 1.12 when go1.13 comes out, then only go 1.13 when go1.14 comes out, etc)?

(cc @ianlancetaylor to validate my interpretation of his post)

So, given that, I'm not convinced that using the go directive in go.mod is a good idea, except for selecting the minimal major version to use when no other info is available.

Example: go1.13.1 is out and is the current default version we're using and the buildpack is used to compile code with a go 1.12 directive. We have two options:

  1. Trust that go1.13.1 will DTRT and properly compile the code base with the go 1.12 features
  2. Use the latest minor version of go1.12

The later seems safer to me. The former is the intended use case, at least as I understand what was written.

@ianlancetaylor
Copy link

Yes: the "go" directive in go.mod indicates the language version to use when compiling code. There is a lot more detail about how this is intended to work at golang/go#28221.

We will support all previous language versions. It's not as hard as you suggest. C and C++ compilers do this routinely, via command line options like GCC's -std=.

@freeformz
Copy link
Contributor

So the go directive in the go.mod file is not for go version selection.

@msiebuhr
Copy link
Author

msiebuhr commented May 9, 2019

I see. I'd still posit that having go 1.12 in the file should make the buildpack should definitely not pick Go 1.11.5.

The right solution would then be to run any Go >= 1.12 w. -lang=go1.12.

@edmorley
Copy link
Member

I'd still posit that having go 1.12 in the file should make the buildpack should definitely not pick Go 1.11.5.

The right solution would then be to run any Go >= 1.12 w. -lang=go1.12

I've filed #378 for discussing this further.

@tomandersen
Copy link

Ran into this today, so it's still happening. I used the GOVERSION env variable set to 1.14.2 to get my app running.

Maybe the Heroku docs can make more of deal about setting GOVERSION in the env?

@axetroy
Copy link

axetroy commented May 22, 2020

I also got this issue

I found it has been closed, can someone tell me how to solve this?

@tomandersen
Copy link

Axetroy - In your Heroku app dashboard, go to settings, "Reveal Config Vars" then add one

GOVERSION with value 1.14.2 or whatever you need.
Screen Shot 2020-05-22 at 8 19 48 AM

@axetroy
Copy link

axetroy commented May 22, 2020

@tomandersen I did n’t read your last comment carefully before I sent the comment, anyway, thank you ❤️

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

No branches or pull requests

7 participants