golangci-lint hangs in sandbox mode
Description
When running golangci-lint run ./... through a git pre-commit hook, the command hangs indefinitely in sandbox mode but completes quickly when run directly on the machine.
Steps to Reproduce
- Have a Go project with
.golangci.ymlconfigured - Have a pre-commit hook that runs
golangci-lint run ./... - Attempt to commit via Claude Code
Expected Behavior
golangci-lint should complete in a reasonable time (similar to running it directly).
Actual Behavior
The command hangs indefinitely. Other commands in the pre-commit hook (like bazel test) complete successfully.
Environment
- Platform: macOS (Darwin 25.1.0)
- Claude Code sandbox mode enabled
Hypothesis
golangci-lint likely needs access to paths that are restricted by the sandbox, such as:
- Go module cache (
~/go/pkg/mod) - Go build cache (
GOCACHE) - Potentially other Go toolchain paths
The sandbox may be blocking read/write access to these directories, causing the linter to hang while waiting for resources.
Workaround
Currently, using dangerouslyDisableSandbox: true allows the commit to proceed, but this defeats the purpose of the sandbox.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗