diff --git a/internal/config/config.go b/internal/config/config.go index cfa8a56a..7791a147 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -246,6 +246,10 @@ func NewConfig() (*Config, error) { err, ) } + + // #nosec G307 + // Believed to be a false-positive from recent gosec release + // https://github.com/securego/gosec/issues/714 defer func() { if err := fh.Close(); err != nil { // Ignore "file already closed" errors diff --git a/internal/files/process.go b/internal/files/process.go index 1f3a76b4..8615ec2f 100644 --- a/internal/files/process.go +++ b/internal/files/process.go @@ -593,6 +593,10 @@ func appendToFile(entry fileEntry, tmpl *template.Template, filename string, per opErr, ) } + + // #nosec G307 + // Believed to be a false-positive from recent gosec release + // https://github.com/securego/gosec/issues/714 defer func(filename string) { if err := f.Close(); err != nil { // Ignore "file already closed" errors diff --git a/internal/fileutils/contains.go b/internal/fileutils/contains.go index 0f493937..16b2162b 100644 --- a/internal/fileutils/contains.go +++ b/internal/fileutils/contains.go @@ -53,6 +53,10 @@ func HasLine(searchTerm string, ignorePrefix string, filename string) (bool, err err, ) } + + // #nosec G307 + // Believed to be a false-positive from recent gosec release + // https://github.com/securego/gosec/issues/714 defer func() { if err := f.Close(); err != nil { // Ignore "file already closed" errors