diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 3a6f64a92..bbf31c9f0 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -21,8 +21,8 @@ jobs: go-version: ^1.20 - name: Install golangci-lint run: | - wget https://github.com/golangci/golangci-lint/releases/download/v1.51.2/golangci-lint-1.51.2-linux-amd64.deb - sudo apt install -y ./golangci-lint-1.51.2-linux-amd64.deb\ + wget https://github.com/golangci/golangci-lint/releases/download/v1.55.2/golangci-lint-1.55.2-linux-amd64.deb + sudo apt install -y ./golangci-lint-1.55.2-linux-amd64.deb - name: Run golangci-lint run: | cd v3 diff --git a/v3/formattedoutput/formattedOutput.go b/v3/formattedoutput/formattedOutput.go index c57e38824..8d5ca229d 100644 --- a/v3/formattedoutput/formattedOutput.go +++ b/v3/formattedoutput/formattedOutput.go @@ -75,8 +75,8 @@ func OutputSummary(zlintResult *zlint.ResultSet, longSummary bool) { " Details ", } lines := [][]string{} - lsl := "" - rescount := "" + var lsl string + var rescount string hlengths := printTableHeadings(headings) // Construct the table lines, but don't repeat diff --git a/v3/integration/lints/lint/lint.go b/v3/integration/lints/lint/lint.go index d9b39acf0..752a3ad1b 100644 --- a/v3/integration/lints/lint/lint.go +++ b/v3/integration/lints/lint/lint.go @@ -137,7 +137,7 @@ type File struct { // // The word "remember" begins at position 81 within this text, therefor LineOf(81) should return line 3. func (f *File) LineOf(pos token.Pos) int { - start := 0 + var start int end := 0 for lineno, line := range f.Lines { start = end diff --git a/v3/integration/lints/lints/not_committing_genTestCerts.go b/v3/integration/lints/lints/not_committing_genTestCerts.go index 2be507bb1..f3294254c 100644 --- a/v3/integration/lints/lints/not_committing_genTestCerts.go +++ b/v3/integration/lints/lints/not_committing_genTestCerts.go @@ -16,6 +16,7 @@ package lints import ( "crypto/sha256" + "encoding/hex" "fmt" "go/ast" "os" @@ -42,7 +43,7 @@ func (i *NotCommittingGenTestCerts) Lint(tree *ast.File, file *lint.File) *lint. if err != nil { return lint.NewResult(fmt.Sprintf("failed to hash the contents of %s", file.Name)) } - got := fmt.Sprintf("%x", hasher.Sum([]byte{})) + got := hex.EncodeToString(hasher.Sum([]byte{})) if got == want { return nil } diff --git a/v3/lint/configuration_test.go b/v3/lint/configuration_test.go index cf7fb8ba3..892ec8d94 100644 --- a/v3/lint/configuration_test.go +++ b/v3/lint/configuration_test.go @@ -1079,7 +1079,7 @@ func TestStripGlobalsFromStructWithPrivates(t *testing.T) { A string B Global C int - //nolint:unused + //nolint:unused,structcheck d int } test := Test{} diff --git a/v3/lints/rfc/lint_serial_number_longer_than_20_octets.go b/v3/lints/rfc/lint_serial_number_longer_than_20_octets.go index 50fa4f07c..20114ae1f 100644 --- a/v3/lints/rfc/lint_serial_number_longer_than_20_octets.go +++ b/v3/lints/rfc/lint_serial_number_longer_than_20_octets.go @@ -70,12 +70,12 @@ func (l *serialNumberTooLong) Execute(c *x509.Certificate) *lint.LintResult { // DER encoded lengths are without having to guess. encoding, err := asn1.Marshal(c.SerialNumber) if err != nil { - return &lint.LintResult{Status: lint.Fatal, Details: fmt.Sprint(err)} + return &lint.LintResult{Status: lint.Fatal, Details: err.Error()} } serial := new(asn1.RawValue) _, err = asn1.Unmarshal(encoding, serial) if err != nil { - return &lint.LintResult{Status: lint.Fatal, Details: fmt.Sprint(err)} + return &lint.LintResult{Status: lint.Fatal, Details: err.Error()} } length := len(serial.Bytes) if length > 20 { diff --git a/v3/test/configuration_test_framework_test.go b/v3/test/configuration_test_framework_test.go index 904f13ead..cd7042914 100644 --- a/v3/test/configuration_test_framework_test.go +++ b/v3/test/configuration_test_framework_test.go @@ -183,7 +183,7 @@ type LintEmbedsAConfiguration struct { } type embeddedConfiguration struct { - IsWebPKI bool `toml:"is_web_pki" comment:"Indicates that the certificate is intended for the Web PKI."` + IsWebPKI bool `comment:"Indicates that the certificate is intended for the Web PKI." toml:"is_web_pki"` } func init() {