Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Vic Shóstak committed Aug 18, 2020
1 parent c0ee654 commit 1d49b48
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ require (
github.com/gofiber/fiber v1.14.2
github.com/klauspost/compress v1.10.11 // indirect
github.com/stretchr/testify v1.6.1
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed // indirect
golang.org/x/sys v0.0.0-20200817155316-9781c653f443 // indirect
gopkg.in/yaml.v2 v2.3.0
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed h1:J22ig1FUekjjkmZUM7pTKixYm8DvrYsvrBZdunYeIuQ=
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200817155316-9781c653f443 h1:X18bCaipMcoJGm27Nv7zr4XYPKGUy92GtqboKC2Hxaw=
golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
9 changes: 8 additions & 1 deletion pkg/apiserver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ func NewConfig(configPath string) (*Config, error) {
if err != nil {
return nil, err
}
defer file.Close()

// Solved gosec issue G307 (CWE-703)
// See: https://github.com/securego/gosec/issues/512#issuecomment-675286833
defer func() {
if err := file.Close(); err != nil {
return
}
}()

// Init new YAML decode
d := yaml.NewDecoder(file)
Expand Down

0 comments on commit 1d49b48

Please sign in to comment.