If ls or other system utilities are customized, goenv fails
netik opened this issue · comments
MacOS and many users frequently have ls
customized in ways that break goenv.
For example when ls
has -F turned on directories are listed with a trailing slash/ which breaks the fuzzy_match
code in scripts/use
goenv should be agnostic about how LS functions, perhaps unsetting things like LSCOLORS and calling /bin/ls
instead of trying to call ls
without a path.
Right now I've patched this by adding modifying the use code to call
fuzzy_match=$($LS_PATH -1 "$GVM_ROOT/gos" | $SORT_PATH | $GREP_PATH "$version" | $HEAD_PATH -n 1 | $GRE\
P_PATH "${version}")
# strip trailing slashes
fuzzy_match=`echo $fuzzy_match | sed s^/$^^`
But this isn't a great solution.
@netik kindly try out this one: https://github.com/ankitcharolia/goenv
@netik if you have time and want to submit a solution via PR I'd be fine with changing the behavior.
Fixed in v2.1.13