Skip to content

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 #97
refs golangci/golangci-lint#2299
  • Loading branch information
atc0005 committed Nov 9, 2021
1 parent bd66c95 commit 23e65b2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/lockss/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func (c *Config) loadFromPropsFile(filename string) (*Config, error) {
if err != nil {
return nil, fmt.Errorf("error occurred opening file: %w", 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 {
logger.Printf(
Expand Down Expand Up @@ -287,6 +291,10 @@ func getLocalDaemonConfig(filename string, ignorePrefix string) (daemonConfig, e
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 23e65b2

Please sign in to comment.