Feature request: Golang 1.20 support
albertoforcato opened this issue · 6 comments
Please add support for Golang 1.20 to the next aws/codebuild/standard image.
Golang 1.20 has been released on 2023-02-01, see https://go.dev/doc/devel/release#go1.20
Is this added? We are stuck with our deployments
This will be supported in Ubuntu based images in a couple of weeks. Amazon Linux base image is being updated to AL2023 and will get this support a few weeks after that, likely by mid-May.
Added the below commands to install phase of buildspec.yaml solved this for me.
- 'cd $HOME/.goenv && git pull --ff-only && cd -'
- 'goenv install 1.20'
- 'goenv local 1.20'
- 'go version'
Added the below commands to install phase of buildspec.yaml solved this for me.
- 'cd $HOME/.goenv && git pull --ff-only && cd -' - 'goenv install 1.20' - 'goenv local 1.20' - 'go version'
- (cd $(goenv root) && git pull --rebase --autostash)
- goenv install 1.20.x # You need to use Patch version because the global/local command does not automatically uses latest version
- goenv global 1.20.x
By using ()
you're telling bash to use a "Sub"-Shell
For reference, this is what I do in my repo to always get the version of Go that I want regardless of whatever is in local goenv:
env:
variables:
TARGET_GOENV_VERSION: "1.20.3"
phases:
install:
runtime-versions:
golang: latest
on-failure: ABORT
commands:
# We want to target a very specific golang version which might already be available from the goenv repo.
- goenv install -l | grep ${TARGET_GOENV_VERSION} || cp ${CODEBUILD_SRC_DIR}/.goenv/${TARGET_GOENV_VERSION} ${HOME}/.goenv/plugins/go-build/share/go-build/${TARGET_GOENV_VERSION}
- goenv install -s ${TARGET_GOENV_VERSION}
- goenv global ${TARGET_GOENV_VERSION}
- go version
Make sure to download the corresponding file from https://github.com/syndbg/goenv/tree/master/plugins/go-build/share/go-build into .goenv/
of your repo.