Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

Commit a1f1a1c

Browse files
committed
Ignore false-positive gosec G307 linting errors
Issues reported after upgrading golangci-lint to v1.43.0. gosec was updated in that version from v2.8.1 to v2.9.1. refs #261 refs golangci/golangci-lint#2299
1 parent 58f917e commit a1f1a1c

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

internal/config/config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ func NewConfig() (*Config, error) {
246246
err,
247247
)
248248
}
249+
250+
// #nosec G307
251+
// Believed to be a false-positive from recent gosec release
252+
// https://github.com/securego/gosec/issues/714
249253
defer func() {
250254
if err := fh.Close(); err != nil {
251255
// Ignore "file already closed" errors

internal/files/process.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,10 @@ func appendToFile(entry fileEntry, tmpl *template.Template, filename string, per
593593
opErr,
594594
)
595595
}
596+
597+
// #nosec G307
598+
// Believed to be a false-positive from recent gosec release
599+
// https://github.com/securego/gosec/issues/714
596600
defer func(filename string) {
597601
if err := f.Close(); err != nil {
598602
// Ignore "file already closed" errors

internal/fileutils/contains.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ func HasLine(searchTerm string, ignorePrefix string, filename string) (bool, err
5353
err,
5454
)
5555
}
56+
57+
// #nosec G307
58+
// Believed to be a false-positive from recent gosec release
59+
// https://github.com/securego/gosec/issues/714
5660
defer func() {
5761
if err := f.Close(); err != nil {
5862
// Ignore "file already closed" errors

0 commit comments

Comments
 (0)