Skip to content

Commit

Permalink
Bump golag-ci lint version to 1.40.1
Browse files Browse the repository at this point in the history
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
  • Loading branch information
nabokihms committed May 27, 2021
1 parent 9594150 commit 4b54433
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
4 changes: 1 addition & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ linters-settings:
local-prefixes: github.com/dexidp/dex
goimports:
local-prefixes: github.com/dexidp/dex
golint:
min-confidence: 0


linters:
Expand All @@ -24,7 +22,6 @@ linters:
- gofmt
- gofumpt
- goimports
- golint
- goprintffuncname
- gosimple
- govet
Expand All @@ -33,6 +30,7 @@ linters:
- nakedret
- nolintlint
- prealloc
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export GOBIN=$(PWD)/bin
LD_FLAGS="-w -X main.version=$(VERSION)"

# Dependency versions
GOLANGCI_VERSION = 1.32.2
GOLANGCI_VERSION = 1.40.1

PROTOC_VERSION = 3.15.6
PROTOC_GEN_GO_VERSION = 1.26.0
Expand Down Expand Up @@ -86,10 +86,13 @@ bin/golangci-lint-${GOLANGCI_VERSION}:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | BINARY=golangci-lint bash -s -- v${GOLANGCI_VERSION}
@mv bin/golangci-lint $@

.PHONY: lint
.PHONY: lint lint-fix
lint: bin/golangci-lint ## Run linter
bin/golangci-lint run

lint-fix: bin/golangci-lint ## Run linter and fix issues
bin/golangci-lint run --fix

.PHONY: fix
fix: bin/golangci-lint ## Fix lint violations
bin/golangci-lint run --fix
Expand Down
10 changes: 5 additions & 5 deletions server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
)

const (
CodeChallengeMethodPlain = "plain"
CodeChallengeMethodS256 = "S256"
codeChallengeMethodPlain = "plain"
codeChallengeMethodS256 = "S256"
)

func (s *Server) handlePublicKeys(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -96,7 +96,7 @@ func (s *Server) discoveryHandler() (http.HandlerFunc, error) {
Subjects: []string{"public"},
GrantTypes: []string{grantTypeAuthorizationCode, grantTypeRefreshToken, grantTypeDeviceCode},
IDTokenAlgs: []string{string(jose.RS256)},
CodeChallengeAlgs: []string{CodeChallengeMethodS256, CodeChallengeMethodPlain},
CodeChallengeAlgs: []string{codeChallengeMethodS256, codeChallengeMethodPlain},
Scopes: []string{"openid", "email", "groups", "profile", "offline_access"},
AuthMethods: []string{"client_secret_basic", "client_secret_post"},
Claims: []string{
Expand Down Expand Up @@ -724,9 +724,9 @@ func (s *Server) handleToken(w http.ResponseWriter, r *http.Request) {

func (s *Server) calculateCodeChallenge(codeVerifier, codeChallengeMethod string) (string, error) {
switch codeChallengeMethod {
case CodeChallengeMethodPlain:
case codeChallengeMethodPlain:
return codeVerifier, nil
case CodeChallengeMethodS256:
case codeChallengeMethodS256:
shaSum := sha256.Sum256([]byte(codeVerifier))
return base64.RawURLEncoding.EncodeToString(shaSum[:]), nil
default:
Expand Down
4 changes: 2 additions & 2 deletions server/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthReques
codeChallengeMethod := q.Get("code_challenge_method")

if codeChallengeMethod == "" {
codeChallengeMethod = CodeChallengeMethodPlain
codeChallengeMethod = codeChallengeMethodPlain
}

client, err := s.storage.GetClient(clientID)
Expand Down Expand Up @@ -470,7 +470,7 @@ func (s *Server) parseAuthorizationRequest(r *http.Request) (*storage.AuthReques
return nil, newErr(errRequestNotSupported, "Server does not support request parameter.")
}

if codeChallengeMethod != CodeChallengeMethodS256 && codeChallengeMethod != CodeChallengeMethodPlain {
if codeChallengeMethod != codeChallengeMethodS256 && codeChallengeMethod != codeChallengeMethodPlain {
description := fmt.Sprintf("Unsupported PKCE challenge method (%q).", codeChallengeMethod)
return nil, newErr(errInvalidRequest, description)
}
Expand Down
4 changes: 2 additions & 2 deletions storage/ent/client/offlinesession.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (d *Database) DeleteOfflineSessions(userID, connID string) error {
return nil
}

// UpdatePassword changes an offline session by user id and connector id using an updater function.
// UpdateOfflineSessions changes an offline session by user id and connector id using an updater function.
func (d *Database) UpdateOfflineSessions(userID string, connID string, updater func(s storage.OfflineSessions) (storage.OfflineSessions, error)) error {
id := offlineSessionID(userID, connID, d.hasher)

Expand Down Expand Up @@ -86,7 +86,7 @@ func (d *Database) UpdateOfflineSessions(userID string, connID string, updater f
}

if err = tx.Commit(); err != nil {
return rollback(tx, "update password commit: %w", err)
return rollback(tx, "update offline session commit: %w", err)
}

return nil
Expand Down
3 changes: 1 addition & 2 deletions storage/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ func New(logger log.Logger) storage.Storage {
// Config is an implementation of a storage configuration.
//
// TODO(ericchiang): Actually define a storage config interface and have registration.
type Config struct {
// The in memory implementation has no config.
type Config struct { // The in memory implementation has no config.
}

// Open always returns a new in memory storage.
Expand Down
2 changes: 1 addition & 1 deletion storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ type Claims struct {
Groups []string
}

// Data needed for PKCE (RFC 7636)
// PKCE is a container for the data needed to perform Proof Key for Code Exchange (RFC 7636) auth flow
type PKCE struct {
CodeChallenge string
CodeChallengeMethod string
Expand Down

0 comments on commit 4b54433

Please sign in to comment.