The `go switch` function
gist.github.com
gist.github.com
For something more comprehensive (of course with a larger install size) and the possibility of handling not just Go, I have had good experiences with asdf [1].
You don't even need to manually switch, you can set a version per folder!
Of course, the thing about bash scripts is that they are super specialized to do one thing, that usually only really works for the creator's workflow.
it uses nix under the hood so it won't mess with your local system
[1] https://bob.build/docs/getting-started/package-management#us...