gimme icon indicating copy to clipboard operation
gimme copied to clipboard

Gimme known argument empty output

Open frextrite opened this issue 6 years ago • 5 comments

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

frextrite avatar Jan 31 '19 12:01 frextrite

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?

joepvd avatar Jan 31 '19 13:01 joepvd

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.

frextrite avatar Jan 31 '19 13:01 frextrite

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., https://github.com/travis-ci/gimme/blob/b31d2f24b732062e9d88cd99d9beed37dd7d2b0f/gimme#L523 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 avatar Jan 31 '19 14:01 BanzaiMan

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

BanzaiMan avatar Jan 31 '19 15:01 BanzaiMan

indeed this line is the root cause of the error when there are no accessible go binary from the path https://github.com/travis-ci/gimme/blob/8a1149c5e817fc92a522454149b1821eff770cbd/gimme#L523

dgsb avatar May 18 '20 09:05 dgsb