Updated linters
This commit is contained in:
		
							parent
							
								
									8d03adfd04
								
							
						
					
					
						commit
						e13a5048eb
					
				|  | @ -3,19 +3,15 @@ run: | |||
| linters: | ||||
|   enable: | ||||
|     - govet | ||||
|     - golint | ||||
|     - ineffassign | ||||
|     - goconst | ||||
|     - deadcode | ||||
|     - gofmt | ||||
|     - goimports | ||||
|     - gosec | ||||
|     - gosimple | ||||
|     - staticcheck | ||||
|     - structcheck | ||||
|     - typecheck | ||||
|     - unused | ||||
|     - varcheck | ||||
|     - bodyclose | ||||
|     - dogsled | ||||
|     - goprintffuncname | ||||
|  | @ -25,6 +21,7 @@ linters: | |||
|     - stylecheck | ||||
|     - unconvert | ||||
|     - gocritic | ||||
|     - revive | ||||
|   disable-all: true | ||||
| issues: | ||||
|   exclude-rules: | ||||
|  | @ -38,6 +35,6 @@ issues: | |||
|     # If we have tests in shared test folders, these can be less strictly linted | ||||
|     - path: tests/.*_tests\.go | ||||
|       linters: | ||||
|         - golint | ||||
|         - revive | ||||
|         - bodyclose | ||||
|         - stylecheck | ||||
|  |  | |||
|  | @ -448,9 +448,8 @@ func (patTest *PassAccessTokenTest) getEndpointWithCookie(cookie string, endpoin | |||
| 		value = strings.TrimPrefix(field, keyPrefix) | ||||
| 		if value != field { | ||||
| 			break | ||||
| 		} else { | ||||
| 			value = "" | ||||
| 		} | ||||
| 		value = "" | ||||
| 	} | ||||
| 	if value == "" { | ||||
| 		return 0, "" | ||||
|  | @ -612,7 +611,7 @@ func (sipTest *SignInPageTest) GetEndpoint(endpoint string) (int, string) { | |||
| type AlwaysSuccessfulValidator struct { | ||||
| } | ||||
| 
 | ||||
| func (AlwaysSuccessfulValidator) Validate(user, password string) bool { | ||||
| func (AlwaysSuccessfulValidator) Validate(_, _ string) bool { | ||||
| 	return true | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,18 +7,18 @@ import ( | |||
| 
 | ||||
| type NoOpLock struct{} | ||||
| 
 | ||||
| func (l *NoOpLock) Obtain(ctx context.Context, expiration time.Duration) error { | ||||
| func (l *NoOpLock) Obtain(_ context.Context, _ time.Duration) error { | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
| func (l *NoOpLock) Peek(ctx context.Context) (bool, error) { | ||||
| func (l *NoOpLock) Peek(_ context.Context) (bool, error) { | ||||
| 	return false, nil | ||||
| } | ||||
| 
 | ||||
| func (l *NoOpLock) Refresh(ctx context.Context, expiration time.Duration) error { | ||||
| func (l *NoOpLock) Refresh(_ context.Context, _ time.Duration) error { | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
| func (l *NoOpLock) Release(ctx context.Context) error { | ||||
| func (l *NoOpLock) Release(_ context.Context) error { | ||||
| 	return nil | ||||
| } | ||||
|  |  | |||
|  | @ -199,7 +199,7 @@ type testVerifier struct { | |||
| 	jwk jose.JSONWebKey | ||||
| } | ||||
| 
 | ||||
| func (t *testVerifier) VerifySignature(ctx context.Context, jwt string) ([]byte, error) { | ||||
| func (t *testVerifier) VerifySignature(_ context.Context, jwt string) ([]byte, error) { | ||||
| 	jws, err := jose.ParseSigned(jwt) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("oidc: malformed jwt: %v", err) | ||||
|  |  | |||
|  | @ -12,19 +12,19 @@ type MockLock struct { | |||
| 	elapsed    time.Duration | ||||
| } | ||||
| 
 | ||||
| func (l *MockLock) Obtain(ctx context.Context, expiration time.Duration) error { | ||||
| func (l *MockLock) Obtain(_ context.Context, expiration time.Duration) error { | ||||
| 	l.expiration = expiration | ||||
| 	return nil | ||||
| } | ||||
| 
 | ||||
| func (l *MockLock) Peek(ctx context.Context) (bool, error) { | ||||
| func (l *MockLock) Peek(_ context.Context) (bool, error) { | ||||
| 	if l.elapsed < l.expiration { | ||||
| 		return true, nil | ||||
| 	} | ||||
| 	return false, nil | ||||
| } | ||||
| 
 | ||||
| func (l *MockLock) Refresh(ctx context.Context, expiration time.Duration) error { | ||||
| func (l *MockLock) Refresh(_ context.Context, expiration time.Duration) error { | ||||
| 	if l.expiration <= l.elapsed { | ||||
| 		return sessions.ErrNotLocked | ||||
| 	} | ||||
|  | @ -33,7 +33,7 @@ func (l *MockLock) Refresh(ctx context.Context, expiration time.Duration) error | |||
| 	return nil | ||||
| } | ||||
| 
 | ||||
| func (l *MockLock) Release(ctx context.Context) error { | ||||
| func (l *MockLock) Release(_ context.Context) error { | ||||
| 	if l.expiration <= l.elapsed { | ||||
| 		return sessions.ErrNotLocked | ||||
| 	} | ||||
|  |  | |||
|  | @ -38,7 +38,7 @@ func validateHeader(header options.Header, names map[string]struct{}) []string { | |||
| 	return msgs | ||||
| } | ||||
| 
 | ||||
| func validateHeaderValue(name string, value options.HeaderValue) []string { | ||||
| func validateHeaderValue(_ string, value options.HeaderValue) []string { | ||||
| 	switch { | ||||
| 	case value.SecretSource != nil && value.ClaimSource == nil: | ||||
| 		return []string{validateSecretSource(*value.SecretSource)} | ||||
|  |  | |||
|  | @ -93,7 +93,7 @@ func (p *ADFSProvider) RefreshSession(ctx context.Context, s *sessions.SessionSt | |||
| 	return refreshed, err | ||||
| } | ||||
| 
 | ||||
| func (p *ADFSProvider) fallbackUPN(ctx context.Context, s *sessions.SessionState) error { | ||||
| func (p *ADFSProvider) fallbackUPN(_ context.Context, s *sessions.SessionState) error { | ||||
| 	claims, err := p.getClaimExtractor(s.IDToken, s.AccessToken) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("could not extract claims: %v", err) | ||||
|  |  | |||
|  | @ -26,13 +26,13 @@ type ValidateSessionTestProvider struct { | |||
| 
 | ||||
| var _ Provider = (*ValidateSessionTestProvider)(nil) | ||||
| 
 | ||||
| func (tp *ValidateSessionTestProvider) GetEmailAddress(ctx context.Context, s *sessions.SessionState) (string, error) { | ||||
| func (tp *ValidateSessionTestProvider) GetEmailAddress(_ context.Context, _ *sessions.SessionState) (string, error) { | ||||
| 	return "", errors.New("not implemented") | ||||
| } | ||||
| 
 | ||||
| // Note that we're testing the internal validateToken() used to implement
 | ||||
| // several Provider's ValidateSession() implementations
 | ||||
| func (tp *ValidateSessionTestProvider) ValidateSession(ctx context.Context, s *sessions.SessionState) bool { | ||||
| func (tp *ValidateSessionTestProvider) ValidateSession(_ context.Context, _ *sessions.SessionState) bool { | ||||
| 	return false | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -93,7 +93,7 @@ func (p *OIDCProvider) Redeem(ctx context.Context, redirectURL, code, codeVerifi | |||
| 
 | ||||
| // EnrichSession is called after Redeem to allow providers to enrich session fields
 | ||||
| // such as User, Email, Groups with provider specific API calls.
 | ||||
| func (p *OIDCProvider) EnrichSession(ctx context.Context, s *sessions.SessionState) error { | ||||
| func (p *OIDCProvider) EnrichSession(_ context.Context, s *sessions.SessionState) error { | ||||
| 	// If a mandatory email wasn't set, error at this point.
 | ||||
| 	if s.Email == "" { | ||||
| 		return errors.New("neither the id_token nor the profileURL set an email") | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue