Skip to content

Commit

Permalink
Go: Bump github.com/securego/gosec/v2 from 2.14.0 to 2.15.0 (#6686)
Browse files Browse the repository at this point in the history
* Go: Bump github.com/securego/gosec/v2 from 2.14.0 to 2.15.0

Bumps [github.com/securego/gosec/v2](https://github.com/securego/gosec) from 2.14.0 to 2.15.0.
- [Release notes](https://github.com/securego/gosec/releases)
- [Changelog](https://github.com/securego/gosec/blob/master/.goreleaser.yml)
- [Commits](securego/gosec@v2.14.0...v2.15.0)

---
updated-dependencies:
- dependency-name: github.com/securego/gosec/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Make sure to handle error returned by io.Closer.Close() in 'defer' statements

This is considered unsafe by gosec otherwise.

[1] securego/gosec#512
[2] securego/gosec#714
[3] https://www.joeshaw.org/dont-defer-close-on-writable-files/

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Armel Soro <asoro@redhat.com>
  • Loading branch information
dependabot[bot] and rm3l committed May 16, 2023
1 parent 67709ff commit 50cb5c9
Show file tree
Hide file tree
Showing 55 changed files with 1,034 additions and 1,165 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ require (
github.com/mattn/go-colorable v0.1.13
github.com/olekukonko/tablewriter v0.0.5
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.6.0
github.com/onsi/gomega v1.24.1
github.com/onsi/ginkgo/v2 v2.8.0
github.com/onsi/gomega v1.26.0
github.com/openshift/api v0.0.0-20220525145417-ee5b62754c68
github.com/openshift/client-go v0.0.0-20220603133046-984ee5ebedcf
github.com/openshift/oc v0.0.0-alpha.0.0.20220402064836-f1f09a392fd1
Expand All @@ -39,7 +39,7 @@ require (
github.com/redhat-developer/alizer/go v0.0.0-20230331140053-a1115da45e0c
github.com/redhat-developer/service-binding-operator v1.0.1-0.20211222115357-5b7bbba3bfb3
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/securego/gosec/v2 v2.14.0
github.com/securego/gosec/v2 v2.15.0
github.com/segmentio/backo-go v1.0.1-0.20200129164019-23eae7c10bd3
github.com/sethvargo/go-envconfig v0.9.0
github.com/spf13/afero v1.6.0
Expand Down Expand Up @@ -190,7 +190,7 @@ require (
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.4.0 // indirect
golang.org/x/tools v0.5.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -978,8 +978,8 @@ github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/ginkgo/v2 v2.6.0 h1:9t9b9vRUbFq3C4qKFCGkVuq/fIHji802N1nrtkh1mNc=
github.com/onsi/ginkgo/v2 v2.6.0/go.mod h1:63DOGlLAH8+REH8jUGdL3YpCpu7JODesutUjdENfUAc=
github.com/onsi/ginkgo/v2 v2.8.0 h1:pAM+oBNPrpXRs+E/8spkeGx9QgekbRVyr74EUvRVOUI=
github.com/onsi/ginkgo/v2 v2.8.0/go.mod h1:6JsQiECmxCa3V5st74AL/AmsV482EDdVrGaVW6z3oYU=
github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
Expand All @@ -991,8 +991,8 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=
github.com/onsi/gomega v1.14.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0=
github.com/onsi/gomega v1.24.1 h1:KORJXNNTzJXzu4ScJWssJfJMnJ+2QJqhoQSRwNlze9E=
github.com/onsi/gomega v1.24.1/go.mod h1:3AOiACssS3/MajrniINInwbfOOtfZvplPzuRSmvt1jM=
github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q=
github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM=
github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
Expand Down Expand Up @@ -1130,8 +1130,8 @@ github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdh
github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo=
github.com/securego/gosec/v2 v2.14.0 h1:U1hfs0oBackChXA72plCYVA4cOlQ4gO+209dHiSNZbI=
github.com/securego/gosec/v2 v2.14.0/go.mod h1:Ff03zEi5NwSOfXj9nFpBfhbWTtROCkg9N+9goggrYn4=
github.com/securego/gosec/v2 v2.15.0 h1:v4Ym7FF58/jlykYmmhZ7mTm7FQvN/setNm++0fgIAtw=
github.com/securego/gosec/v2 v2.15.0/go.mod h1:VOjTrZOkUtSDt2QLSJmQBMWnvwiQPEjg0l+5juIqGk8=
github.com/segmentio/analytics-go/v3 v3.2.1 h1:G+f90zxtc1p9G+WigVyTR0xNfOghOGs/PYAlljLOyeg=
github.com/segmentio/analytics-go/v3 v3.2.1/go.mod h1:p8owAF8X+5o27jmvUognuXxdtqvSGtD0ZrfY2kcS9bE=
github.com/segmentio/backo-go v1.0.1-0.20200129164019-23eae7c10bd3 h1:bXa9PgdGOTKQ8ji1pO8LzG3sCh7udxfb/4ObDwC8ork=
Expand Down Expand Up @@ -1733,8 +1733,8 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.10-0.20220218145154-897bd77cd717/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
golang.org/x/tools v0.4.0 h1:7mTAgkunk3fr4GAloyyCasadO6h9zSsQZbwvcaIciV4=
golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
golang.org/x/tools v0.5.0 h1:+bSpV5HIeWkuvgaMfI3UmKRThoTA5ODJTUd8T17NO+4=
golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
18 changes: 12 additions & 6 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,12 @@ func addFileToIgnoreFile(gitIgnoreFile, filename string, fs filesystem.Filesyste
// TODO(feloy) sync with devfile library?
func DisplayLog(followLog bool, rd io.ReadCloser, writer io.Writer, compName string, numberOfLastLines int) (err error) {

defer rd.Close()
defer func() {
cErr := rd.Close()
if err == nil {
err = cErr
}
}()

// Copy to stdout (in yellow)
color.Set(color.FgYellow)
Expand Down Expand Up @@ -529,14 +534,15 @@ func DisplayLog(followLog bool, rd io.ReadCloser, writer io.Writer, compName str
} else {
reader := bufio.NewReader(rd)
var lines []string
var line string
for {
line, err := reader.ReadString('\n')
line, err = reader.ReadString('\n')
if err != nil {
if err != io.EOF {
return err
} else {
break
}
err = nil
break
}

lines = append(lines, line)
Expand All @@ -548,13 +554,13 @@ func DisplayLog(followLog bool, rd io.ReadCloser, writer io.Writer, compName str
}

for i := index; i < len(lines); i++ {
_, err := fmt.Fprintf(writer, lines[i])
_, err = fmt.Fprintf(writer, lines[i])
if err != nil {
return err
}
}
}
return
return err

}

Expand Down
6 changes: 5 additions & 1 deletion tests/helper/helper_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ func HttpWaitForWithStatus(url string, match string, maxRetry int, interval int,
time.Sleep(time.Duration(interval) * time.Second)
continue
}
defer resp.Body.Close()
defer func() {
if cErr := resp.Body.Close(); cErr != nil {
fmt.Fprintf(GinkgoWriter, "[warn] error closing response body: %v\n", cErr)
}
}()
if resp.StatusCode == expectedCode {
body, _ = io.ReadAll(resp.Body)
if strings.Contains(string(body), match) {
Expand Down
8 changes: 7 additions & 1 deletion tests/helper/helper_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"net/http"
"net/url"

. "github.com/onsi/ginkgo/v2"

"github.com/redhat-developer/odo/pkg/api"
)

Expand All @@ -28,7 +30,11 @@ func (o Registry) GetIndex() ([]api.DevfileStack, error) {
if err != nil {
return nil, err
}
defer resp.Body.Close()
defer func() {
if cErr := resp.Body.Close(); cErr != nil {
fmt.Fprintf(GinkgoWriter, "[warn] error closing response body: %v\n", cErr)
}
}()

var target []api.DevfileStack
err = json.NewDecoder(resp.Body).Decode(&target)
Expand Down
86 changes: 86 additions & 0 deletions vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions vendor/github.com/onsi/ginkgo/v2/core_dsl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions vendor/github.com/onsi/ginkgo/v2/decorator_dsl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 50cb5c9

Please sign in to comment.