From 4a72836925dfce291253fb9a4bd47baf74ba8e90 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Wed, 8 Apr 2020 01:14:35 +0200 Subject: [PATCH] Lint: Fix some minor linter errors Signed-off-by: Knut Ahlers --- main.go | 11 ++++++----- plugins/auth/google/auth.go | 2 +- plugins/mfa/totp/mfa.go | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 39bd1b50..6c199015 100644 --- a/main.go +++ b/main.go @@ -144,10 +144,11 @@ func main() { case syscall.SIGHUP: if yamlSource, err = loadConfiguration(); err != nil { log.WithError(err).Error("Unable to reload configuration") - } else { - if err = initializeModules(yamlSource); err != nil { - log.WithError(err).Error("Unable to initialize modules") - } + continue + } + + if err = initializeModules(yamlSource); err != nil { + log.WithError(err).Error("Unable to initialize modules") } default: @@ -167,7 +168,7 @@ func handleAuthRequest(res http.ResponseWriter, r *http.Request) { switch err { case plugins.ErrNoValidUserFound: // No valid user found, check whether special anonymous "user" has access - // Username is set to 0x0 character to prevent accidential whitelist-match + // Username is set to 0x0 character to prevent accidental whitelist-match if mainCfg.ACL.HasAccess(string(0x0), nil, r) { mainCfg.AuditLog.Log(auditEventValidate, r, map[string]string{"result": "anonymous access granted"}) // #nosec G104 - This is only logging res.WriteHeader(http.StatusOK) diff --git a/plugins/auth/google/auth.go b/plugins/auth/google/auth.go index 5eb3e923..6639c347 100644 --- a/plugins/auth/google/auth.go +++ b/plugins/auth/google/auth.go @@ -216,7 +216,7 @@ func (a *AuthGoogleOAuth) getUserFromToken(ctx context.Context, token *oauth2.To httpClient := conf.Client(ctx, token) client, err := v2.NewService(ctx, option.WithHTTPClient(httpClient)) if err != nil { - return "", errors.Wrap(err, "Unable to instanciate OAuth2 API service") + return "", errors.Wrap(err, "Unable to instantiate OAuth2 API service") } tok, err := client.Tokeninfo().Context(ctx).Do() diff --git a/plugins/mfa/totp/mfa.go b/plugins/mfa/totp/mfa.go index b5721609..51b345ea 100644 --- a/plugins/mfa/totp/mfa.go +++ b/plugins/mfa/totp/mfa.go @@ -93,7 +93,7 @@ func (m MFATOTP) exec(c plugins.MFAConfig) (string, error) { } if n := len(secret) % 8; n != 0 { - secret = secret + strings.Repeat("=", 8-n) + secret += strings.Repeat("=", 8-n) } return totp.GenerateCodeCustom(strings.ToUpper(secret), time.Now(), generatorOpts)