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

GOBIN should be set when installing default pkgs on go > 1.16 #151

Open
jeffguorg opened this issue Jan 23, 2025 · 0 comments · May be fixed by #152
Open

GOBIN should be set when installing default pkgs on go > 1.16 #151

jeffguorg opened this issue Jan 23, 2025 · 0 comments · May be fixed by #152

Comments

@jeffguorg
Copy link

jeffguorg commented Jan 23, 2025

Describe the bug
GOBIN is not set when install default-golang-pkgs. and thus go install new binaries into current version of go's GOBIN instead of new GOBIN.

To Reproduce
Steps to reproduce the behavior:

  1. asdf install golang 1.24rc2
  2. check $(env ASDF_GOLANG_VERSION=1.24rc2 go env GOBIN)
  3. the directory ~/.asdf/installs/golang/1.24rc2/bin does not exists
  4. current version of golang insall's GOBIN is updated. for example i'm using 1.23.5 for now, binaries inside .asdf/installs/golang/1.23.5/bin are updated

Expected behavior
asdf install golang VERSION should install binaries into ~/.asdf/installs/golang/$VERSION/bin

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
after some investigation, GOBIN is set for each go version since 962a601 , but not used in install scripts. add GOROOT="$ASDF_INSTALL_PATH/go" GOPATH="$ASDF_INSTALL_PATH/packages" PATH="$go_path:$PATH" go env GOBIN in install script will show that the GOBIN directory does not match the new installed version

suggest: add GOBIN in bin/install like this:

diff --git a/bin/install b/bin/install
index b196283..eea3093 100755
--- a/bin/install
+++ b/bin/install
@@ -51,6 +51,7 @@ install_default_go_pkgs() {
 
       GOROOT="$ASDF_INSTALL_PATH/go" \
         GOPATH="$ASDF_INSTALL_PATH/packages" \
+        GOBIN="$ASDF_INSTALL_PATH/bin" \
         PATH="$go_path:$PATH" \
         go install "$name" >/dev/null && rc=$? || rc=$?
     else
mkungla added a commit to mkungla/asdf-golang that referenced this issue Feb 1, 2025
Previously, when GOBIN was empty, default packages listed in
$ASDF_GOLANG_DEFAULT_PACKAGES_FILE were installed to
$ASDF_INSTALL_PATH/packages/bin. This could cause confusion,
as user-installed binaries might end up in different locations.

This commit ensures that GOBIN is always set, so all binaries
are consistently installed into $ASDF_INSTALL_PATH/bin.
Additionally, the use of $ASDF_INSTALL_PATH/packages/bin is
deprecated to prevent inconsistencies.

Closes asdf-community#151

Signed-off-by: Marko Kungla <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant