go-nv / goenv

:blue_car: Like pyenv and rbenv, but for Go.

Home Page:https://github.com/go-nv/goenv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1.21.0 having install_bsd_arm is causing errors with install_bsd_arm: command not found

nguyengg opened this issue · comments

commented

Previous go-build files such as https://github.com/go-nv/goenv/blob/master/plugins/go-build/share/go-build/1.20.7 do not have links for install_bsd_arm so my build hasn't run into this build error before.
But since https://github.com/go-nv/goenv/blob/master/plugins/go-build/share/go-build/1.21.0, these lines:

install_bsd_arm "Go Freebsd arm 1.21.0" "go1.21.0.freebsd-arm64.tar.gz#bca5be1a9934fc522cb1a2e4849bb9f12ee6b480b48949e36a4dfb8e755a4b25"
install_bsd_arm "Go Freebsd arm 1.21.0" "go1.21.0.freebsd-arm.tar.gz#f4c9c91fa9c37d6d6b7644f3f6b67167b2a44bd48c0cba1d2a5ff5fd50ceb364"

... are causing my build to fail with this error:

[Container] 2023/08/09 15:53:30 Running command echo $PATH
40 | /root/.goenv/shims:/root/.goenv/bin:/go/bin:/go/bin:/usr/local/go/bin:/usr/local/bin/sbt/bin:/root/.phpenv/shims:/root/.phpenv/bin:/root/.pyenv/shims:/root/.pyenv/bin:/root/.rbenv/shims:/usr/local/rbenv/bin:/usr/local/rbenv/shims:/root/.dotnet/:/root/.dotnet/tools/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/codebuild/user/bin

[Container] 2023/08/09 15:53:31 Running command goenv install -s ${TARGET_GOENV_VERSION}
46 | /root/.goenv/plugins/go-build/share/go-build/1.21.0: line 9: install_bsd_arm: command not found
47 |  
48 | BUILD FAILED (Amazon Linux 2023 using go-build 2.1.3)

I included the $PATH in case it may help with debugging. Would anyone have an idea what's going on?

Looks like that is new; let me see what we need to add

Resolved in #339

@nguyengg @ugol please verify

commented

Can confirm that fixed it for me!

[Container] 2023/08/09 17:16:40 Running command 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}
40 | 1.21.0
41 |  
42 | [Container] 2023/08/09 17:16:41 Running command goenv install -s ${TARGET_GOENV_VERSION}
43 | Downloading go1.21.0.linux-arm64.tar.gz...
44 | -> go1.21.0.linux-arm64.tar.gz

Thanks for the quick turnaround!

Can confirm that fixed it for me!

[Container] 2023/08/09 17:16:40 Running command 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}
40 | 1.21.0
41 |  
42 | [Container] 2023/08/09 17:16:41 Running command goenv install -s ${TARGET_GOENV_VERSION}
43 | Downloading go1.21.0.linux-arm64.tar.gz...
44 | -> go1.21.0.linux-arm64.tar.gz

Thanks for the quick turnaround!

No problem. Glad I could help

commented

Sidenote: if you're using AWS CodeBuild images (or any images) that cache goenv repo, you may still run into that problem until the image is updated. I was using an aarch64 image for which I had to manually check out goenv so the latest commit is always pulled.

Sidenote: if you're using AWS CodeBuild images (or any images) that cache goenv repo, you may still run into that problem until the image is updated. I was using an aarch64 image for which I had to manually check out goenv so the latest commit is always pulled.

See https://github.com/go-nv/goenv#aws-codebuild. I documented buildspec steps so you can pull the latest goenv in your prebuild phase.

commented

I had something similar with:

      # AWS CodeBuild Docker image for aarch64 doesn't install goenv so we must install it.
      # Additionally, image for amd64 may hav outdated goenv as well so we should update it.
      - |
        if [[ ! -d "$HOME/.goenv" ]] ; then
          git clone --depth 1 https://github.com/syndbg/goenv.git $HOME/.goenv
          PATH="/root/.goenv/shims:/root/.goenv/bin:/go/bin:$PATH"
          GOENV_DISABLE_GOPATH=1
        else
          git -C "$HOME/.goenv" pull --rebase
        fi

Just wanted to leave a note in case others found this issue and thought it still unresolved because of outdated goenv.