1
0
mirror of https://github.com/securego/gosec.git synced 2025-11-25 22:22:17 +02:00

Update to Go 1.20 and fix unit tests (#923)

* Fix unit tests for Go 1.20

* Update to Go 1.20 in the build scripts

* Remove support for 1.18 in the build

* Fix the golangci lint version according to Go version used

* Fix golangci version string

* Fix gci linter warning

* Remove golint in favour of golangci
This commit is contained in:
Cosmin Cojocar
2023-02-06 14:15:05 +01:00
committed by GitHub
parent b4270dd020
commit df14837174
5 changed files with 18 additions and 18 deletions

View File

@@ -4,6 +4,7 @@ import (
"errors"
"log"
"os"
"regexp"
"strings"
. "github.com/onsi/ginkgo/v2"
@@ -152,13 +153,19 @@ var _ = Describe("Analyzer", func() {
err = analyzer.Process(buildTags, pkg.Path)
Expect(err).ShouldNot(HaveOccurred())
_, _, errors := analyzer.Report()
Expect(len(errors)).To(Equal(1))
foundErr := false
for _, ferr := range errors {
Expect(len(ferr)).To(Equal(1))
match, err := regexp.MatchString(ferr[0].Err, `expected declaration, found '}'`)
if !match || err != nil {
continue
}
foundErr = true
Expect(ferr[0].Line).To(Equal(4))
Expect(ferr[0].Column).To(Equal(5))
Expect(ferr[0].Err).Should(MatchRegexp(`expected declaration, found '}'`))
}
Expect(foundErr).To(BeTrue())
})
It("should not report errors when a nosec line comment is present", func() {