Skip to content

Commit

Permalink
fix: check returned error before deferring f.Close() (#6007)
Browse files Browse the repository at this point in the history
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
  • Loading branch information
testwill committed Jan 26, 2024
1 parent adfde63 commit 13f797f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/fanal/analyzer/pkg/apk/apk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ func TestParseApkInfo(t *testing.T) {
t.Run(testname, func(t *testing.T) {
a := alpinePkgAnalyzer{}
f, err := os.Open(tt.path)
defer f.Close()
require.NoError(t, err)
defer f.Close()
scanner := bufio.NewScanner(f)
gotPkgs, gotFiles := a.parseApkInfo(scanner)

Expand Down

0 comments on commit 13f797f

Please sign in to comment.