Fix golangci-lint errcheck warnings; add make fixstyle
errcheck flagged six unchecked Close() calls. The production write path in indexgen.ProcessDir now closes the index file explicitly after Execute and surfaces the close error so a deferred flush failure isn't lost; tests use _ = f.Close() since they don't care. Also adds a 'make fixstyle' target that runs gofmt -w over the tree, matching the convention used elsewhere. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -271,7 +271,7 @@ func TestReadDirEntries(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to write to file: %v", err)
|
||||
}
|
||||
f.Close()
|
||||
_ = f.Close()
|
||||
}
|
||||
|
||||
// Create a subdirectory
|
||||
@@ -328,7 +328,7 @@ func TestReadDirEntriesWithHidden(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create test file %s: %v", file, err)
|
||||
}
|
||||
f.Close()
|
||||
_ = f.Close()
|
||||
}
|
||||
|
||||
opts := &Options{
|
||||
@@ -365,7 +365,7 @@ func TestReadDirEntriesWithRegexExclusion(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create test file %s: %v", file, err)
|
||||
}
|
||||
f.Close()
|
||||
_ = f.Close()
|
||||
}
|
||||
|
||||
regex := regexp.MustCompile("(build|node_modules)")
|
||||
|
||||
Reference in New Issue
Block a user