Fix 15 lint errors: dupl, gosec, revive, staticcheck, unparam
Reduced golangci-lint issues from 56 to 41: Fixed: - dupl (2→0): Extracted parseLabelArgs helper, added nolint for cobra commands - gosec G104 (4→0): Handle unhandled errors with _ = assignments - gosec G302/G306 (4→0): Fixed file permissions from 0644 to 0600 - revive exported (4→0): Added proper godoc comments for all exported types - staticcheck SA1019 (1→0): Removed deprecated netErr.Temporary() call - staticcheck SA4003 (1→0): Removed impossible uint64 < 0 check - unparam (8→0): Removed unused params/returns, added nolint where needed Renamed types in compact package to avoid stuttering: - CompactConfig → Config - CompactResult → Result Remaining 41 issues are documented baseline: - gocyclo (24): High complexity in large functions - gosec G204/G115 (17): False positives for subprocess/conversions Closes bd-92 Amp-Thread-ID: https://ampcode.com/threads/T-1c136506-d703-4781-bcfa-eb605999545a Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -72,7 +72,7 @@ func TestEnvironmentBinding(t *testing.T) {
|
||||
t.Run(tt.envVar, func(t *testing.T) {
|
||||
// Set environment variable
|
||||
oldValue := os.Getenv(tt.envVar)
|
||||
os.Setenv(tt.envVar, tt.value)
|
||||
_ = os.Setenv(tt.envVar, tt.value)
|
||||
defer os.Setenv(tt.envVar, oldValue)
|
||||
|
||||
// Re-initialize viper to pick up env var
|
||||
@@ -101,7 +101,7 @@ actor: configuser
|
||||
flush-debounce: 15s
|
||||
`
|
||||
configPath := filepath.Join(tmpDir, "config.yaml")
|
||||
if err := os.WriteFile(configPath, []byte(configContent), 0644); err != nil {
|
||||
if err := os.WriteFile(configPath, []byte(configContent), 0600); err != nil {
|
||||
t.Fatalf("failed to write config file: %v", err)
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ func TestConfigPrecedence(t *testing.T) {
|
||||
}
|
||||
|
||||
configPath := filepath.Join(beadsDir, "config.yaml")
|
||||
if err := os.WriteFile(configPath, []byte(configContent), 0644); err != nil {
|
||||
if err := os.WriteFile(configPath, []byte(configContent), 0600); err != nil {
|
||||
t.Fatalf("failed to write config file: %v", err)
|
||||
}
|
||||
|
||||
@@ -190,8 +190,8 @@ func TestConfigPrecedence(t *testing.T) {
|
||||
}
|
||||
|
||||
// Test 2: Environment variable overrides config file
|
||||
os.Setenv("BD_JSON", "true")
|
||||
defer os.Unsetenv("BD_JSON")
|
||||
_ = os.Setenv("BD_JSON", "true")
|
||||
defer func() { _ = os.Unsetenv("BD_JSON") }()
|
||||
|
||||
err = Initialize()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user