Skip to content

Commit

Permalink
Upgrade golangci-lint to 1.54.2 (#986)
Browse files Browse the repository at this point in the history
  • Loading branch information
lestrrat authored Sep 26, 2023
1 parent c41f2a8 commit c68c06c
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
check-latest: true
- uses: golangci/golangci-lint-action@v3
with:
version: v1.49.0
version: v1.54.2
- name: Run go vet
run: |
go vet ./...
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ linters:
enable-all: true
disable:
- cyclop
- deadcode # deprecated
- depguard
- dupl
- exhaustive
- exhaustivestruct
Expand Down Expand Up @@ -44,9 +46,11 @@ linters:
- nosnakecase
- paralleltest
- scopelint # deprecated
- structcheck # deprecated
- tagliatelle
- testpackage
- thelper # Tests are fine
- varcheck # deprecated
- varnamelen # Short names are ok
- wrapcheck
- wsl
Expand Down
2 changes: 1 addition & 1 deletion jwe/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (h *stdHeaders) Clone(ctx context.Context) (Headers, error) {
return dst, nil
}

func (h *stdHeaders) Copy(ctx context.Context, dst Headers) error {
func (h *stdHeaders) Copy(_ context.Context, dst Headers) error {
for _, pair := range h.makePairs() {
//nolint:forcetypeassert
key := pair.Key.(string)
Expand Down
2 changes: 1 addition & 1 deletion jwe/internal/keyenc/keyenc.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (kw *Noop) KeyID() string {
return kw.keyID
}

func (kw *Noop) EncryptKey(cek []byte) (keygen.ByteSource, error) {
func (kw *Noop) EncryptKey(_ []byte) (keygen.ByteSource, error) {
return keygen.ByteKey(kw.sharedkey), nil
}

Expand Down
2 changes: 1 addition & 1 deletion jwe/jwe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ type dummyKeyEncrypterDecrypter struct {
key []byte
}

func (kd *dummyKeyEncrypterDecrypter) DecryptKey(alg jwa.KeyEncryptionAlgorithm, cek []byte, _ jwe.Recipient, _ *jwe.Message) ([]byte, error) {
func (kd *dummyKeyEncrypterDecrypter) DecryptKey(_ jwa.KeyEncryptionAlgorithm, cek []byte, _ jwe.Recipient, _ *jwe.Message) ([]byte, error) {
return bytes.TrimSuffix(cek, kd.key), nil
}

Expand Down
2 changes: 1 addition & 1 deletion jwk/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func getGlobalFetcher() httprc.Fetcher {
}

// SetGlobalFetcher allows users to specify a custom global fetcher,
// which is used by the `Fetch` function. Assigning `nil` forces the
// which is used by the `Fetch` function. Assigning `nil` forces
// the default fetcher to be (re)created when the next call to
// `jwk.Fetch` occurs
//
Expand Down
4 changes: 2 additions & 2 deletions jwk/jwk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2036,12 +2036,12 @@ func TestGH567(t *testing.T) {
})
}

func TestAvailableCurves(t *testing.T) {
func TestAvailableCurves(_ *testing.T) {
// Not much to test here, but this silences the linters
_ = jwk.AvailableCurves()
}

func TestCurveForAlgorithm(t *testing.T) {
func TestCurveForAlgorithm(_ *testing.T) {
// Not much to test here, but this silences the linters
_, _ = jwk.CurveForAlgorithm(jwa.P521)
}
Expand Down
2 changes: 1 addition & 1 deletion jws/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (h *stdHeaders) AsMap(ctx context.Context) (map[string]interface{}, error)
return iter.AsMap(ctx, h)
}

func (h *stdHeaders) Copy(ctx context.Context, dst Headers) error {
func (h *stdHeaders) Copy(_ context.Context, dst Headers) error {
for _, pair := range h.makePairs() {
//nolint:forcetypeassert
key := pair.Key.(string)
Expand Down
2 changes: 1 addition & 1 deletion jws/jws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (es *dummyECDSACryptoSigner) Public() crypto.PublicKey {
return es.raw.Public()
}

func (es *dummyECDSACryptoSigner) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) {
func (es *dummyECDSACryptoSigner) Sign(rand io.Reader, digest []byte, _ crypto.SignerOpts) ([]byte, error) {
// The implementation is the same as ecdsaCryptoSigner.
// This is just here to test the interface conversion
r, s, err := ecdsa.Sign(rand, es.raw, digest)
Expand Down
2 changes: 1 addition & 1 deletion jwt/openid/birthdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (b *BirthdateClaim) Accept(v interface{}) error {
}
return nil
case string:
// yeah, yeah, regexp is slow. PR's welcome
// yeah, regexp is slow. PR's welcome
indices := birthdateRx.FindStringSubmatchIndex(v)
if indices == nil {
return fmt.Errorf(`invalid pattern for birthdate`)
Expand Down

0 comments on commit c68c06c

Please sign in to comment.