From 158a90d20f1d6b66157b0da375e42f6091711af1 Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Tue, 19 Oct 2021 13:24:26 +0200 Subject: [PATCH] common: Ignore gosec bug See https://github.com/securego/gosec/issues/714. --- internal/common/distribution.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/common/distribution.go b/internal/common/distribution.go index ef0cc1661..2ee306dd3 100644 --- a/internal/common/distribution.go +++ b/internal/common/distribution.go @@ -67,7 +67,9 @@ func ReadDistributions(distsDir, distro string) ([]DistributionFile, error) { if err != nil { return err } - defer func() { // #nosec G307 https://github.com/securego/gosec/issues/714 + // nosec because of https://github.com/securego/gosec/issues/714 + /* #nosec G307 */ + defer func() { err := f.Close() if err != nil { fmt.Printf("Error closing file: %v", err) @@ -142,7 +144,9 @@ func FindPackages(distsDir, distro, arch, search string) ([]Package, error) { if err != nil { return nil, err } - defer func() { // #nosec G307 https://github.com/securego/gosec/issues/714 + // nosec because of https://github.com/securego/gosec/issues/714 + /* #nosec G307 */ + defer func() { err := f.Close() if err != nil { fmt.Printf("Error closing file: %v", err)