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 GH-70
refs golangci/golangci-lint#2299
  • Loading branch information
atc0005 committed Nov 30, 2021
1 parent a9e9705 commit 7cfcb25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions activefile/activefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ func (afr activeFileReader) filterEntries(validPrefixes []string) ([]ezproxy.Fil
if err != nil {
return nil, fmt.Errorf("func filterEntries: error encountered opening file %q: %w", afr.Filename, 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
4 changes: 4 additions & 0 deletions auditlog/auditlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ func (alr auditLogReader) AllSessionEntries() (SessionEntries, error) {
if err != nil {
return nil, fmt.Errorf("func AllSessionEntries: error encountered opening file %q: %w", alr.Filename, 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 7cfcb25

Please sign in to comment.