heroku / heroku-buildpack-go

Heroku Go Buildpack
https://devcenter.heroku.com/categories/go
MIT License
792 stars 511 forks source link

Use go1.20.14 for DefaultVersion #540

Closed ashmckenzie closed 6 months ago

ashmckenzie commented 7 months ago

I noticed when trying to deploy a Go app via dokku using Go version devel-a10e42f (which is is https://github.com/golang/go/releases/tag/go1.22.0) I received the following error using the most recent https://github.com/heroku/heroku-buildpack-go/ (0210495):

Before

$ make deploy
--snip--
-----> New Go Version, clearing old cache
-----> Installing bootstrap go1.12.17
-----> Fetching go1.12.17.linux-amd64.tar.gz... done
-----> Downloading development Go version devel-a10e42f... done
-----> Compiling development Go version devel-a10e42f
       Building Go cmd/dist using /cache/go1.12.17/go. (go1.12.17 linux/amd64)
       can't load package: package ./cmd/dist: found packages main (build.go) and building_Go_requires_Go_1_20_6_or_later (notgo120.go) in /cache/devel-a10e42f/go/src/cmd/dist

After

$ dokku buildpacks:set https://github.com/ashmckenzie/heroku-buildpack-go#82e57c6

$ make deploy
--snip--
-----> New Go Version, clearing old cache
-----> Installing bootstrap go1.20.13
-----> Fetching go1.20.13.linux-amd64.tar.gz... done
-----> Downloading development Go version devel-a10e42f... done
-----> Compiling development Go version devel-a10e42f
       Building Go cmd/dist using /cache/go1.20.13/go. (go1.20.13 linux/amd64)
       Building Go toolchain1 using /cache/go1.20.13/go.
       Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
       Building Go toolchain2 using go_bootstrap and Go toolchain1.
       Building Go toolchain3 using go_bootstrap and Go toolchain2.
       Building packages and commands for linux/amd64.
---
       Installed Go for linux/amd64 in /cache/devel-a10e42f/go
       Installed commands in /cache/devel-a10e42f/go/bin
       *** You need to add /cache/devel-a10e42f/go/bin to your PATH.
       go version devel +a10e42f Wed Feb 08:14:33 2024 +0000 linux/amd64

Increasing DefaultVersion to go1.20.13 as recommended then allows custom Go versions to be built.

joshwlewis commented 7 months ago

Yeah, it makes sense to update this. We really should be defaulting to a version that is actually supported by the go team. I just added go1.20.14 in #544. Mind updating to that? This will also need a CHANGELOG.md entry.

ashmckenzie commented 7 months ago

~It's a shame my commit wasn't cherry picked into https://github.com/heroku/heroku-buildpack-go/pull/544 and then updated to 1.20.14 but I guess as long as the bug is fixed.~

~Closing now that https://github.com/heroku/heroku-buildpack-go/pull/544 is merged.~

Apologies for the misunderstanding, re-opening.

joshwlewis commented 6 months ago

@ashmckenzie thanks for the update / rebase. This is looking like a breaking change (for folks still using old go versions and/or old module management systems), so I'm proceeding cautiously. I've fixed a few broken tests, I'll continue to address the rest.

I haven't decided if this can be merged just yet. There might need to be some deprecation messaging first.

ashmckenzie commented 6 months ago

Thanks for the update @joshwlewis 🙇 Is it too late to move to semantic versioning for the tags and make this a major change? (I know the answer 🙂)

joshwlewis commented 6 months ago

@ashmckenzie thanks again. I am going to bring this in to main, but wait to ship it until next week.