{{ message }}
disable automatic toolchain switching for golang hooks#3304
Merged
asottile merged 1 commit intoNov 25, 2024
Merged
Conversation
Contributor
Author
|
Unrelated to this PR, but mypy fails with pre-commit/pre_commit/xargs.py Line 31 in de85900 Replacing try/except with |
Sorry, something went wrong.
asottile
reviewed
Sep 28, 2024
asottile
reviewed
Oct 26, 2024
asottile
reviewed
Oct 26, 2024
asottile
reviewed
Nov 9, 2024
122528a to
109628c
Compare
November 25, 2024 23:47
asottile
approved these changes
Nov 25, 2024
WojasKrk
suggested changes
Jan 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.

Resolves #3300
I only disabled the toolchain switching if the version is not
system. I did this becausesystemis the default if go is installed globally and nolanguage_versionis explicitly specified. In this case users likely doesn't care which version of go is used as long as their hooks are working, so I think it makes more sense to allow the toolchain switching since it doesn't break user expectations and other than a small performance hit on hook installation doesn't have negative impact.If we were to disable toolchain switching regardless of the version, many hooks would break since many environments lag with their go version. For example, in GitHub-hosted runners for GitHub Actions the pre-installed go version is
1.21which is two versions behind the current version, so it's likely that a lot of hooks work thanks to automatic toolchain switching without even knowing.