Skip to content

Commit

Permalink
fix: missing exclusion of rehash on init (#437)
Browse files Browse the repository at this point in the history
Cut time by 75%

~ via 🐹 v1.23.4 via 🐍 v3.12.8 (main) on ☁️
➜  time eval "$(goenv init -)"

real	0m0.755s
user	0m0.138s
sys		0m0.207s

~ via 🐹 v1.23.4 via 🐍 v3.12.8 (main) on ☁️
➜  time eval "$(goenv init - --no-rehash)"

real	0m0.407s
user	0m0.099s
sys		0m0.140s

After fix:

~ via 🐹 v1.23.4 via 🐍 v3.12.8 (main) on ☁️
➜  time eval "$(goenv init - --no-rehash)"

real	0m0.133s
user	0m0.032s
sys		0m0.051s

Signed-off-by: Justin Lecher <justin.lecher@astrazeneca.com>
  • Loading branch information
jlec authored Jan 17, 2025
1 parent dacd2a8 commit ed2e05f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libexec/goenv-init
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ if [ "$shell" != "fish" ]; then
EOS
fi

# NOTE: Rehash again, but only to export managed paths
cat <<EOS
goenv rehash --only-manage-paths
if [ -z "$no_rehash" ]; then
# NOTE: Rehash again, but only to export managed paths
cat <<EOS
goenv rehash --only-manage-paths
EOS
fi

0 comments on commit ed2e05f

Please sign in to comment.