-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use shim approach instead of modifying PATH
#18
Comments
We could also accomplish something similar with a I don't know how common it is for users of |
@tianon I can contribute an anecdata point in that I use |
That sounds like an argument for the shims being optional and possibly even
non-default. 😅
|
@tianon oh! I was thinking that the shims would help with this situation 🤔 The shim would take into account the cwd and env and use the correct version, maybe bail with an error if the version isn't already installed? Although bailing early would be more like the behavior of |
So you're thinking |
Right (I think) 🤔 There's precedent in other tooling to use a |
Seems pretty reasonable! Because I think better in code (especially Bash), here's a really rough example of my interpretation of your thoughts into a #!/usr/bin/env bash
set -Eeuo pipefail
e="$(GIMME_BAIL_ON_UNAVAILABLE=1 gimme "${GIMME_GO_VERSION:-module}")"
eval "$e"
exec go "$@"
# perhaps even instead something like:
tool="$(basename "$0")"
exec "$tool" "$@"
# (so this same script can be symlinked to all the possible "go" tools we might want to invoke? are there more than just "go" that are interesting? I suppose "gofmt" is probably the only one, since it's the only other entry in Go's "bin/" directory) |
@tianon Yes! and thank you! |
A pattern that's been adopted by other language version managers like
rbenv
andpyenv
is to generate "shim" executables so that the value ofPATH
can remain stable. I think this would be a reasonable enhancement forgimme
, too 🎉The text was updated successfully, but these errors were encountered: