Summary
Custom linter has identified 4 findings where os.Setenv is used to mutate the process environment. This is an anti-pattern that makes code harder to test and reason about.
Root Cause
os.Setenv mutates the global process environment, which can:
- Cause cross-test contamination
- Make behavior harder to predict and test
- Introduce global state dependencies
Affected Locations
pkg/cli/add_interactive_orchestrator.go:73 - os.Setenv usage
pkg/cli/engine_secrets.go:329 - os.Setenv usage
pkg/cli/engine_secrets.go:377 - os.Setenv usage
pkg/cli/engine_secrets.go:430 - os.Setenv usage
Remediation Strategy
Replace os.Setenv calls with explicit parameter passing:
- Identify what configuration is being set
- Pass it as a parameter or dependency injection
- Test the functions directly without environment mutations
- Run
make golint-custom to validate fixes
Expected Outcome
All 4 findings resolved. Validate with:
make golint-custom | grep "os.Setenv"
Should return no matches.
Generated by 🧌 LintMonster · 139.7 AIC · ⌖ 4.37 AIC · ⊞ 19.9K · ◷
Summary
Custom linter has identified 4 findings where
os.Setenvis used to mutate the process environment. This is an anti-pattern that makes code harder to test and reason about.Root Cause
os.Setenvmutates the global process environment, which can:Affected Locations
pkg/cli/add_interactive_orchestrator.go:73- os.Setenv usagepkg/cli/engine_secrets.go:329- os.Setenv usagepkg/cli/engine_secrets.go:377- os.Setenv usagepkg/cli/engine_secrets.go:430- os.Setenv usageRemediation Strategy
Replace
os.Setenvcalls with explicit parameter passing:make golint-customto validate fixesExpected Outcome
All 4 findings resolved. Validate with:
Should return no matches.