-
Notifications
You must be signed in to change notification settings - Fork 513
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
Use the go version in go.mod to set the minimal Go version to use #378
Comments
I've re-read all of the posts involved with this directive that I can find and I think the only "safe" thing to do is, in the absence of the I am concerned about users trying to pin to a minor version using the |
Also, if its the minimal version, then when we default to go1.14 and their module file still contains So maybe it needs to be option 2 - specific major version. |
Yeah I agree that option 2 sounds best. |
Internal Work Item: W-6993075 |
I am using
I think it would fix all the problems if the buildpack could just detect and bump the minimal viable version to 1.13 without CVEs. |
`go` records own version in `go.mod` as go 1.13 This fix should let the buildpack to detect it if nothing else is set. heroku#378 (comment)
* Use the go version in go.mod if no +heroku comment `go` records own version in `go.mod` as go 1.13 This fix should let the buildpack to detect it if nothing else is set. #378 (comment) * CHANGELOG.md go.mod version changes * Add Go 1.13 to fixtures for go.mod tests * Specify expected go version install in test * Update test expectation Co-authored-by: Josh W Lewis <[email protected]>
#411 is merged, so this issue will be fixed in the next buildpack version aka v162. |
…elease (#488) * Fix CHANGELOG entry for go.mod parsing in #378 * Add v162 release Since the changelog was not updated when #487 was released: ``` $ h buildpacks:versions heroku/go | head -n4 Version Released At Status ─────── ──────────────────────── ───────── 162 2022-05-23T19:42:06.208Z published 161 2022-03-15T22:11:28.510Z published ``` Co-authored-by: Ed Morley <[email protected]>
This has shipped with v163! |
(I forgot it was me that filed this! 😆 ) |
Currently this buildpack requires that the Go version be specified in a Heroku-specific format in
go.mod
, otherwise the build will output something like:At first glance it seems like the buildpack should just be using the
go 1.NN
style annotations now supported by Go ingo.mod
.However as discussed in #301, those annotations are meant to indicate the minimum language feature version required, and not necessarily the compiler version to use. (For example
go.mod
might say it requiresgo 1.12
, which a go 1.13 compiler could support by running in "go 1.12 mode").Whilst that may be true, I suspect in the common case, people just want their entire app to run using the same version in production, CI, ... - and will never need to use a mixture of language/compiler versions.
The current implementation (requiring Heroku-specific annotations) not only adds to the boilerplate required for projects using this buildpack, but can also mean projects unknowingly run a different version of Go in production.
For example in https://github.com/heroku/release-dyno-watcher/pull/191 that service was upgraded to Go 1.13, and whilst CI is now testing against Go 1.13, production is still running Go 1.12 per the buildpack default (which was not spotted since the build "The go.mod file for this project does not specify a Go version" warning is only a warning not fatal).
As such, would it be possible to either:
go.mod
version set the minimal version of the Go compiler to use (iff the user hasn't overridden with the// +heroku goVersion
style syntax)go.mod
version set the specific major version of the Go compiler to use (iff the user hasn't overridden with the// +heroku goVersion
style syntax)Whilst (1) might be closer to the intent of the upstream Go project (see #301 (comment)), I personally would prefer (2) since it offers the least surprise.
The text was updated successfully, but these errors were encountered: