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

goenv --list doesn't show 1.19.2 version #266

Closed
Lisenish opened this issue Nov 1, 2022 · 21 comments
Closed

goenv --list doesn't show 1.19.2 version #266

Lisenish opened this issue Nov 1, 2022 · 21 comments

Comments

@Lisenish
Copy link

Lisenish commented Nov 1, 2022

Looking at this PR #250 I think 1.19.2 version should be supported, but I can't install it on the latest goenv version.

❯ goenv --version
goenv 2.0.2
❯ goenv install --list
Available versions:
  1.2.2
  1.3.0
  1.3.1
  1.3.2
  1.3.3
  1.4.0
  1.4.1
  1.4.2
  1.4.3
  1.5.0
  1.5.1
  1.5.2
  1.5.3
  1.5.4
  1.6.0
  1.6.1
  1.6.2
  1.6.3
  1.6.4
  1.7.0
  1.7.1
  1.7.3
  1.7.4
  1.7.5
  1.8.0
  1.8.1
  1.8.3
  1.8.4
  1.8.5
  1.8.7
  1.9.0
  1.9.1
  1.9.2
  1.9.3
  1.9.4
  1.9.5
  1.9.6
  1.9.7
  1.10.0
  1.10beta2
  1.10rc1
  1.10rc2
  1.10.1
  1.10.2
  1.10.3
  1.10.4
  1.10.5
  1.10.6
  1.10.7
  1.10.8
  1.11.0
  1.11beta2
  1.11beta3
  1.11rc1
  1.11rc2
  1.11.1
  1.11.2
  1.11.3
  1.11.4
  1.11.5
  1.11.6
  1.11.7
  1.11.8
  1.11.9
  1.11.10
  1.11.11
  1.11.12
  1.11.13
  1.12.0
  1.12beta1
  1.12beta2
  1.12rc1
  1.12.1
  1.12.2
  1.12.3
  1.12.4
  1.12.5
  1.12.6
  1.12.7
  1.12.8
  1.12.9
  1.12.10
  1.12.11
  1.12.12
  1.12.13
  1.12.14
  1.12.15
  1.12.16
  1.12.17
  1.13.0
  1.13beta1
  1.13rc1
  1.13rc2
  1.13.1
  1.13.2
  1.13.3
  1.13.4
  1.13.5
  1.13.6
  1.13.7
  1.13.8
  1.13.9
  1.13.10
  1.13.11
  1.13.12
  1.13.13
  1.13.14
  1.13.15
  1.14.0
  1.14beta1
  1.14rc1
  1.14.1
  1.14.2
  1.14.3
  1.14.4
  1.14.5
  1.14.6
  1.14.7
  1.14.8
  1.14.9
  1.14.10
  1.14.11
  1.14.12
  1.14.13
  1.14.14
  1.14.15
  1.15.0
  1.15beta1
  1.15rc2
  1.15.1
  1.15.2
  1.15.3
  1.15.4
  1.15.5
  1.15.6
  1.15.7
  1.15.8
  1.15.9
  1.15.10
  1.15.11
  1.15.12
  1.15.13
  1.15.14
  1.15.15
  1.16.0
  1.16beta1
  1.16.1
  1.16.2
  1.16.3
  1.16.4
  1.16.5
  1.16.6
  1.16.7
  1.16.8
  1.16.9
  1.16.10
  1.16.11
  1.16.12
  1.16.13
  1.16.14
  1.16.15
  1.17.0
  1.17beta1
  1.17rc1
  1.17rc2
  1.17.1
  1.17.2
  1.17.3
  1.17.4
  1.17.5
  1.17.6
  1.17.7
  1.17.8
  1.17.9
  1.17.10
  1.17.11
  1.17.12
  1.17.13
  1.18.0
  1.18beta1
  1.18beta2
  1.18rc1
  1.18.1
  1.18.2
  1.18.3
  1.18.4
  1.18.5
  1.18.6
  1.19.0
  1.19beta1
  1.19.1
@Lisenish Lisenish changed the title goenv --list doesn't show 1.91.2 goenv --list doesn't show 1.19.2 version Nov 1, 2022
@ghost
Copy link

ghost commented Nov 1, 2022

@Lisenish

What OS + Arch are you using?

I am able to print the same list with 2.0.2 and 1.19.2 shows up for me?

$ goenv install -l | grep 1.19
  1.19.0
  1.19beta1
  1.19.1
  1.19.2
$ goenv --version
goenv 2.0.2

FWIW I tested on both macOS Monterey and Ubuntu 20.04 LTS

@Lisenish
Copy link
Author

Lisenish commented Nov 2, 2022

@EfChouTR Weird, I'm on MacOS Monterey 12.6.1, goenv is installed and upgraded via brew.
I guess it's probably something local then... I will try to investigate additionally a bit later, but if anyone has any ideas please share

@ChronosMasterOfAllTime
Copy link
Contributor

Weird ask, try using bash instead of zsh (assuming zsh is the default shell on macOS). It shouldn't make a difference. If it does we will need to look into what's causing the value to drop off the list

@Lisenish
Copy link
Author

Lisenish commented Nov 8, 2022

@ChronosMasterOfAllTime
It's the same for me in bash 😢

goenv 2.0.2
bash-3.2$ goenv install -l | grep 1.19
  1.19.0
  1.19beta1
  1.19.1
bash-3.2$

@Lisenish
Copy link
Author

Lisenish commented Nov 8, 2022

@ChronosMasterOfAllTime @EfChouTR Are you guys using brew version?
I tried to reinstall, and I still have the same behavior.
Just in case, it's downloaded from here

==> Downloading https://ghcr.io/v2/homebrew/core/goenv/blobs/sha256:4e9f5c36fe507bcd9486d4166b27bddd6281a8f6556b5ec63dd2d7b714f7e2e7
Already downloaded: /Users/d-ivanov/Library/Caches/Homebrew/downloads/e8dc62e8a5d497f9935f2cb01fa76e73da32b48e7d64a6efe68980c39a9c2812--goenv--2.0.2.arm64_monterey.bottle.tar.gz

@ChronosMasterOfAllTime
Copy link
Contributor

@Lisenish

ls -la $(which goenv)

And figure out if this has the same path prefix as

ls -la $(brew --prefix goenv)

(The first command will be a path to the binary, the second is the installation dir, so it may be missing /bin/goenv from the second command if they are indeed the same)

@Lisenish
Copy link
Author

Lisenish commented Dec 8, 2022

@ChronosMasterOfAllTime
Sorry for a big delay.
I tried to upgrade to the most recent version, and it's still the same problem, I see only 1.19.1 version as the most recent one.

ls -la $(which goenv) /opt/homebrew/bin/goenv -> ../Cellar/goenv/2.0.4/bin/goenv

ls -la $(brew --prefix goenv) /opt/homebrew/opt/goenv -> ../Cellar/goenv/2.0.4

Also, it's strange, but the version of goenv now is also incorrect (it should be 2.0.4)

goenv -v goenv 2.0.3

@ghost
Copy link

ghost commented Dec 8, 2022

looks like the go--version code didnt get updated with the new version (oops)

@ChronosMasterOfAllTime
Copy link
Contributor

@Lisenish

cd $(brew --prefix goenv)/plugins/go-build/share/go-build

then

ls

Does 1.19.2 or 1.19.3 show up in the directories list?

@Lisenish
Copy link
Author

@ChronosMasterOfAllTime Yes, it does!

@ChronosMasterOfAllTime
Copy link
Contributor

Weird behavior; I updated to 2.0.5 in the brew formula ..Homebrew/homebrew-core#120887

maybe it will be fixed there?

@Lisenish
Copy link
Author

@ChronosMasterOfAllTime I hope, I'll check once it's published, thank you

@Lisenish
Copy link
Author

@ChronosMasterOfAllTime
It didn't fix it, but I finally found time to read the sources and investigate the issue:

I've found that while goenv has the correct version, but install plugin seems outdated:

❯ goenv install --version
go-build 2.0.0beta1
❯ go-build --version
go-build 2.0.5

From sources, it looks these versions should be the same actually?

  1. https://github.com/syndbg/goenv/tree/master/plugins/go-build/share/go-build
  2. My Homebrew prefix for it looks like this
brew --prefix goenv
/opt/homebrew/opt/goenv

but when I checked cat /opt/homebrew/opt/goenv/plugins/go-build.install.sh, it contains the following:

if [ -z "${PREFIX}" ]; then
  PREFIX="/opt/homebrew"
fi

BIN_PATH="${PREFIX}/bin"
SHARE_PATH="${PREFIX}/share/go-build"

The path here looks incorrect and actually /opt/homebrew/share/go-build doesn't exist, but it somehow works still and showing

  1. go-build --definitions outputs correct list of versions (updated)

I didn't have time to investigate further yet, but maybe this will provide some idea to you what might be wrong?
goenv install refers to some incorrect go-build version?

@ChronosMasterOfAllTime
Copy link
Contributor

Thanks for all the information! It gives me something to work with and be able to pin down the problem.

@ChronosMasterOfAllTime
Copy link
Contributor

ChronosMasterOfAllTime commented Feb 19, 2023

Havent had time to take a crack at this; I assume if we set PREFIX=$(brew --prefix) we will get better behaviors there.

EDIT: I took a peek at my version of the file

image

Something's not quite right here. Seems we have a mismatch?

@tabris233
Copy link

tabris233 commented Feb 26, 2023

If you install goenv using the command brew install goenv, the version is often outdated and not synchronised with the latest git commit. Therefore, even if the latest version of go is available under the directory "https://github.com/syndbg/goenv/tree/master/plugins/go-build/share/go-build", it cannot be seen in "goenv install --list".

You can use brew install --HEAD goenv to install the latest version of goenv.

If you encounter the error message "invalid option: --HEAD", you need to first brew uninstall goenv.

@Lisenish
Copy link
Author

@ChronosMasterOfAllTime
Unfortunately, PREFIX=$(brew --prefix) didn't fix it for me for some reason.
I was going to comment that indeed the most recent version from sources looks different from mine, and I wanted to investigate could it be that brew packages for some reason contain the outdated version, but @tabris233 already answered it. I've tried to install with --HEAD option, but it didn't help (I've tried multiple times with removing goenv first and reinstalling, example log below).

❯ brew uninstall --force goenv
Uninstalling goenv... (308 files, 503.3KB)
❯ brew install --HEAD goenv
==> Fetching goenv
######################################################################## 100.0%
==> Cloning https://github.com/syndbg/goenv.git
Updating /Users/d-ivanov/Library/Caches/Homebrew/goenv--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at 7af20a1 Add support for go 1.19.6 and 1.20.1 (#288)
🍺  /opt/homebrew/Cellar/goenv/HEAD-7af20a1: 311 files, 506.4KB, built in 3 seconds
==> Running `brew cleanup goenv`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/d-ivanov/Library/Caches/Homebrew/goenv--2.0.5... (133.2KB)
❯ goenv install -l | grep 1.19
  1.19.0
  1.19beta1
  1.19.1

Could it be that something is wrong with brew package? I never created a package by myself, so I need to read the docs first to try to debug it, I may take a look later but maybe someone can check faster than me

@ChronosMasterOfAllTime
Copy link
Contributor

@Lisenish try wiping the goenv installed by brew. Instead clone the repo to path of your choosing and add it to your PATH. See if the behavior persists that way. If it doesn't it's something with the way brew behaves on your system.

@Lisenish
Copy link
Author

@ChronosMasterOfAllTime

Sorry for the slow responses:

EDIT: I took a peek at my version of the file. Something's not quite right here. Seems we have a mismatch?

Is it the brew version, or just from the repo?
Looks like we're replacing it in brew
https://github.com/Homebrew/homebrew-core/blob/14692a303c3fecbf65acd18d3b2bc9f8edb5ec02/Formula/goenv.rb#L32 that's the reason probably

@Lisenish try wiping the goenv installed by brew. Instead clone the repo to path of your choosing and add it to your PATH. See if the behavior persists that way. If it doesn't it's something with the way brew behaves on your system.

I was pretty sure the repo version would fix it, but I'm just curious if it maybe some issue with the brew version.
So I've investigated a little bit and found a fix for me:

❯ goenv which go-build
_my_home_folder_/.goenv/plugins/go-build/bin/go-build
❯ goenv which goenv
/opt/homebrew/Cellar/goenv/HEAD-7af20a1/libexec/goenv

❯ ls /opt/homebrew/Cellar/goenv/HEAD-7af20a1/plugins/go-build/share/go-build | grep 1.20
1.20.0
1.20.1
1.20rc1
1.20rc2

❯ ls /Users/d-ivanov/.goenv/plugins/go-build/share/go-build/ | grep 1.20
Empty

❯ echo $GOENV_ROOT
_my_home_folder_/.goenv
❯ GOENV_ROOT=/opt/homebrew/Cellar/goenv/HEAD-7af20a1/libexec/goenv
❯ goenv install -l | grep 1.20
  1.20.0
  1.20rc1
  1.20rc2
  1.20.1

So looks like for some reason I have .goenv in home folder which I shouldn't have since I'm using brew version and for some reason GOENV_ROOT is pointing to that folder?
I think I never tweaked anything and never installed it manually without the brew so not sure if there's some bug maybe? Or maybe it's still just me and I somehow messed up my env? Unfortunately, I don't know the codebase well enough to quickly try to investigate by myself now.

If you think it's just my local mess and other brew users are fine - let's close this ticket, thanks for all the help here 🙇

@ChronosMasterOfAllTime
Copy link
Contributor

No worries! Thanks for troubleshooting!

@Lisenish
Copy link
Author

Lisenish commented Mar 16, 2023

In case somebody has the similar issue: I've found that I had GOROOT and PATH env vars modifications in my .zshenv and .zshrc files. I just removed .goenv folder and env these vars and left single eval "$(goenv init -)" command in .zshenv, looks like it's finally fixed for me.

Maybe this was somewhat related to this also #186

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants