Skip to content

Commit 4becce3

Browse files
committed
Fix linter
1 parent 44a3f15 commit 4becce3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

internal/docs/template_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,24 @@ func TestGoTypeDefined(t *testing.T) {
1919
if err != nil {
2020
t.Fatalf("cannot open %s", path)
2121
}
22-
defer f.Close()
22+
defer func(f *os.File) {
23+
err := f.Close()
24+
if err != nil {
25+
t.Fatal(err.Error())
26+
}
27+
}(f)
2328

2429
scanner := bufio.NewScanner(f)
2530
if !scanner.Scan() {
2631
t.Logf("❌ %s: file is empty", path)
2732
t.Fail()
2833
}
34+
2935
firstLine := scanner.Text()
3036
if gotypeRE.MatchString(firstLine) {
3137
return nil
3238
}
39+
3340
t.Logf("gotype missing at top of file: %s", path)
3441
t.Fail()
3542
}

0 commit comments

Comments
 (0)