fix: Bump golangci-lint version and fix some linter's problems

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
This commit is contained in:
m.nabokikh
2020-10-18 01:02:29 +04:00
parent 28b2350cd2
commit 4d63e9cd68
12 changed files with 97 additions and 79 deletions

View File

@@ -679,7 +679,7 @@ type DeviceRequest struct {
Expiry time.Time `json:"expiry"`
}
// AuthRequestList is a list of AuthRequests.
// DeviceRequestList is a list of DeviceRequests.
type DeviceRequestList struct {
k8sapi.TypeMeta `json:",inline"`
k8sapi.ListMeta `json:"metadata,omitempty"`

View File

@@ -84,7 +84,9 @@ type scanner interface {
Scan(dest ...interface{}) error
}
func (c *conn) GarbageCollect(now time.Time) (result storage.GCResult, err error) {
func (c *conn) GarbageCollect(now time.Time) (storage.GCResult, error) {
result := storage.GCResult{}
r, err := c.Exec(`delete from auth_request where expiry < $1`, now)
if err != nil {
return result, fmt.Errorf("gc auth_request: %v", err)
@@ -117,7 +119,7 @@ func (c *conn) GarbageCollect(now time.Time) (result storage.GCResult, err error
result.DeviceTokens = n
}
return
return result, err
}
func (c *conn) CreateAuthRequest(a storage.AuthRequest) error {

View File

@@ -384,23 +384,24 @@ func randomString(n int) (string, error) {
return string(bytes), nil
}
//DeviceRequest represents an OIDC device authorization request. It holds the state of a device request until the user
//authenticates using their user code or the expiry time passes.
// DeviceRequest represents an OIDC device authorization request. It holds the state of a device request until the user
// authenticates using their user code or the expiry time passes.
type DeviceRequest struct {
//The code the user will enter in a browser
// The code the user will enter in a browser
UserCode string
//The unique device code for device authentication
// The unique device code for device authentication
DeviceCode string
//The client ID the code is for
// The client ID the code is for
ClientID string
//The Client Secret
// The Client Secret
ClientSecret string
//The scopes the device requests
// The scopes the device requests
Scopes []string
//The expire time
// The expire time
Expiry time.Time
}
// DeviceToken is a structure which represents the actual token of an authorized device and its rotation parameters
type DeviceToken struct {
DeviceCode string
Status string