chore: fix lint violations

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
This commit is contained in:
Mark Sagi-Kazar 2022-05-25 11:17:34 +02:00
parent 1736f95024
commit a02f2e8fac
No known key found for this signature in database
GPG Key ID: 31AB0439F4C5C90E
14 changed files with 25 additions and 23 deletions

View File

@ -168,7 +168,8 @@ func (p *conn) Login(ctx context.Context, scopes connector.Scopes, username, pas
func (p *conn) Prompt() string { return "username" }
func (p *conn) Refresh(
ctx context.Context, scopes connector.Scopes, identity connector.Identity) (connector.Identity, error) {
ctx context.Context, scopes connector.Scopes, identity connector.Identity,
) (connector.Identity, error) {
token, err := p.getAdminToken(ctx)
if err != nil {
return identity, fmt.Errorf("keystone: failed to obtain admin token: %v", err)

View File

@ -4,7 +4,6 @@ import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
@ -454,22 +453,22 @@ func setupVariables(t *testing.T) {
keystoneAdminPassEnv := "DEX_KEYSTONE_ADMIN_PASS"
keystoneURL = os.Getenv(keystoneURLEnv)
if keystoneURL == "" {
t.Skip(fmt.Sprintf("variable %q not set, skipping keystone connector tests\n", keystoneURLEnv))
t.Skipf("variable %q not set, skipping keystone connector tests\n", keystoneURLEnv)
return
}
keystoneAdminURL = os.Getenv(keystoneAdminURLEnv)
if keystoneAdminURL == "" {
t.Skip(fmt.Sprintf("variable %q not set, skipping keystone connector tests\n", keystoneAdminURLEnv))
t.Skipf("variable %q not set, skipping keystone connector tests\n", keystoneAdminURLEnv)
return
}
adminUser = os.Getenv(keystoneAdminUserEnv)
if adminUser == "" {
t.Skip(fmt.Sprintf("variable %q not set, skipping keystone connector tests\n", keystoneAdminUserEnv))
t.Skipf("variable %q not set, skipping keystone connector tests\n", keystoneAdminUserEnv)
return
}
adminPass = os.Getenv(keystoneAdminPassEnv)
if adminPass == "" {
t.Skip(fmt.Sprintf("variable %q not set, skipping keystone connector tests\n", keystoneAdminPassEnv))
t.Skipf("variable %q not set, skipping keystone connector tests\n", keystoneAdminPassEnv)
return
}
authTokenURL = keystoneURL + "/v3/auth/tokens/"

View File

@ -220,7 +220,8 @@ func (c *Config) OpenConnector(logger log.Logger) (interface {
connector.Connector
connector.PasswordConnector
connector.RefreshConnector
}, error) {
}, error,
) {
return c.openConnector(logger)
}

View File

@ -78,7 +78,8 @@ func (c *Config) Open(id string, logger log.Logger) (conn connector.Connector, e
// OpenWithHTTPClient returns a connector which can be used to login users through an upstream
// OpenShift OAuth2 provider. It provides the ability to inject a http.Client.
func (c *Config) OpenWithHTTPClient(id string, logger log.Logger,
httpClient *http.Client) (conn connector.Connector, err error) {
httpClient *http.Client,
) (conn connector.Connector, err error) {
ctx, cancel := context.WithCancel(context.Background())
wellKnownURL := strings.TrimSuffix(c.Issuer, "/") + wellKnownURLPath
@ -156,7 +157,8 @@ func (e *oauth2Error) Error() string {
// HandleCallback parses the request and returns the user's identity
func (c *openshiftConnector) HandleCallback(s connector.Scopes,
r *http.Request) (identity connector.Identity, err error) {
r *http.Request,
) (identity connector.Identity, err error) {
q := r.URL.Query()
if errType := q.Get("error"); errType != "" {
return identity, &oauth2Error{errType, q.Get("error_description")}
@ -176,7 +178,8 @@ func (c *openshiftConnector) HandleCallback(s connector.Scopes,
}
func (c *openshiftConnector) Refresh(ctx context.Context, s connector.Scopes,
oldID connector.Identity) (connector.Identity, error) {
oldID connector.Identity,
) (connector.Identity, error) {
var token oauth2.Token
err := json.Unmarshal(oldID.ConnectorData, &token)
if err != nil {
@ -189,7 +192,8 @@ func (c *openshiftConnector) Refresh(ctx context.Context, s connector.Scopes,
}
func (c *openshiftConnector) identity(ctx context.Context, s connector.Scopes,
token *oauth2.Token) (identity connector.Identity, err error) {
token *oauth2.Token,
) (identity connector.Identity, err error) {
client := c.oauth2Config.Client(ctx, token)
user, err := c.user(ctx, client)
if err != nil {

View File

@ -11,7 +11,6 @@ type keyPair struct {
// keys are generated beforehand so we don't have to generate RSA keys for every test.
var jsonWebKeys = []keyPair{
{
Public: mustLoadJWK(`{
"use": "sig",

View File

@ -14,10 +14,7 @@ import (
entSQL "entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/schema"
"github.com/go-sql-driver/mysql"
// Register postgres driver.
_ "github.com/lib/pq"
"github.com/go-sql-driver/mysql" // Register mysql driver.
"github.com/dexidp/dex/pkg/log"
"github.com/dexidp/dex/storage"

View File

@ -13,9 +13,7 @@ import (
entSQL "entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/schema"
// Register postgres driver.
_ "github.com/lib/pq"
_ "github.com/lib/pq" // Register postgres driver.
"github.com/dexidp/dex/pkg/log"
"github.com/dexidp/dex/storage"

View File

@ -7,9 +7,7 @@ import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/schema"
// Register sqlite driver.
_ "github.com/mattn/go-sqlite3"
_ "github.com/mattn/go-sqlite3" // Register sqlite driver.
"github.com/dexidp/dex/pkg/log"
"github.com/dexidp/dex/storage"

View File

@ -24,7 +24,7 @@ const kubeconfigPathVariableName = "DEX_KUBERNETES_CONFIG_PATH"
func TestStorage(t *testing.T) {
if os.Getenv(kubeconfigPathVariableName) == "" {
t.Skip(fmt.Sprintf("variable %q not set, skipping kubernetes storage tests\n", kubeconfigPathVariableName))
t.Skipf("variable %q not set, skipping kubernetes storage tests\n", kubeconfigPathVariableName)
}
suite.Run(t, new(StorageTestSuite))

View File

@ -1,3 +1,4 @@
//go:build cgo
// +build cgo
package sql

View File

@ -1,3 +1,4 @@
//go:build cgo
// +build cgo
package sql

View File

@ -1,3 +1,4 @@
//go:build go1.11
// +build go1.11
package sql

View File

@ -1,3 +1,4 @@
//go:build cgo
// +build cgo
package sql

View File

@ -1,3 +1,4 @@
//go:build cgo
// +build cgo
package sql