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

Gimme known argument empty output #172

Open
frextrite opened this issue Jan 31, 2019 · 5 comments
Open

Gimme known argument empty output #172

frextrite opened this issue Jan 31, 2019 · 5 comments
Labels

Comments

@frextrite
Copy link

gimme --known doesn't output anything. Technically it should return a list of go versions that could be installed.

Note: I cloned the repository and ran ./gimme --known

@joepvd
Copy link
Contributor

joepvd commented Jan 31, 2019

Could not reproduce this behavior. One possible cause would be if the file ~/.gimme/versions/known-versions.txt exists, is new enough, and is empty. In that case, you could delete that file, or use --force-known-update.
If that does not help, could you edit gimme and do set -x at the top, and e.g. gist the resulting log?

@frextrite
Copy link
Author

Here's the gist

While testing I found 2 things

  1. Removing set -e makes the script work perfectly. Does this mean the script is exiting somewhere with non zero status?
  2. Adding && at the end of Line 577 makes the script work. Regarding the above point, I think this is the location where the script is exiting with non-zero status.

PS: I don't have much experience in shell scripting. I came to the above conclusion after doing a couple of Google searches so I may be wrong.

@BanzaiMan
Copy link
Contributor

BanzaiMan commented Jan 31, 2019

I was able to reproduce this issue.

Inside _list_known(), we call _list_versions() function, but this function can fail for various reasons. In my case, when there is no go at all—e.g.,

gimme/gimme

Line 523 in b31d2f2

current_version="$(go env GOROOT 2>/dev/null)"

Since gimme sets errexit option, this terminates the script immediately, and we are left with no output from the () subshell, which feeds nothing to the following pipeline of grep | _version_sort | uniq.

It is not clear to me why _list_versions() is called inside the _list_known() function. Don't we just want to skip it instead?

@BanzaiMan
Copy link
Contributor

Ah, I guess we call _list_versions in case local versions don't show up in the remote list.

@dgsb
Copy link

dgsb commented May 18, 2020

indeed this line is the root cause of the error when there are no accessible go binary from the path

gimme/gimme

Line 523 in 8a1149c

current_version="$(go env GOROOT 2>/dev/null)"

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

No branches or pull requests

5 participants