Skip to content

Commit 3f0ae91

Browse files
committed
fix: resolve errcheck lint errors in config_test.go
1 parent 26d6bac commit 3f0ae91

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

config/config_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func TestLoadConfigFileInvalid(t *testing.T) {
219219
}
220220
defer os.Remove(tmpFile.Name())
221221

222-
tmpFile.WriteString("invalid: yaml: content: [[[")
222+
_, _ = tmpFile.WriteString("invalid: yaml: content: [[[")
223223
tmpFile.Close()
224224

225225
_, err = LoadConfigFile(tmpFile.Name())
@@ -302,17 +302,21 @@ func TestFindConfigFile(t *testing.T) {
302302
t.Fatalf("Failed to create temp dir: %v", err)
303303
}
304304
defer os.RemoveAll(tmpDir)
305-
defer os.Chdir(origDir)
305+
defer func() { _ = os.Chdir(origDir) }()
306306

307307
// Change to temp dir (no config files)
308-
os.Chdir(tmpDir)
308+
if err := os.Chdir(tmpDir); err != nil {
309+
t.Fatalf("Failed to chdir: %v", err)
310+
}
309311
result := FindConfigFile()
310312
if result != "" {
311313
t.Errorf("FindConfigFile should return empty when no config exists, got: %s", result)
312314
}
313315

314316
// Create config.yaml
315-
os.WriteFile("config.yaml", []byte("workers: 50\n"), 0644)
317+
if err := os.WriteFile("config.yaml", []byte("workers: 50\n"), 0644); err != nil {
318+
t.Fatalf("Failed to write config.yaml: %v", err)
319+
}
316320
result = FindConfigFile()
317321
if result != "config.yaml" {
318322
t.Errorf("FindConfigFile should find config.yaml, got: %s", result)

0 commit comments

Comments
 (0)