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

Commit

Permalink
Ignore false-positive gosec G307 linting errors
Browse files Browse the repository at this point in the history
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
  • Loading branch information
atc0005 committed Nov 10, 2021
1 parent 58f917e commit a1f1a1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions internal/files/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions internal/fileutils/contains.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a1f1a1c

Please sign in to comment.