From b1a01b1727f00a9f2ac94d74f7f861b44c0fb6fa Mon Sep 17 00:00:00 2001 From: Amir Zarrinkafsh Date: Fri, 18 Sep 2020 22:05:43 +1000 Subject: [PATCH] [CI] Update QEMU to v5.1.0-2 (#1321) * [CI] Update QEMU to v5.1.0-2 * Fix linter errors from golangci-lint update --- cmd/authelia-scripts/cmd_docker.go | 2 +- cmd/authelia-scripts/main.go | 2 +- internal/authentication/file_user_provider_test.go | 6 +++--- internal/configuration/validator/authentication.go | 2 +- internal/configuration/validator/secrets.go | 2 +- internal/handlers/handler_verify_test.go | 1 - internal/notification/smtp_notifier.go | 2 +- internal/storage/sql_provider_test.go | 2 +- 8 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cmd/authelia-scripts/cmd_docker.go b/cmd/authelia-scripts/cmd_docker.go index 76184d693..d7d7833dd 100644 --- a/cmd/authelia-scripts/cmd_docker.go +++ b/cmd/authelia-scripts/cmd_docker.go @@ -46,7 +46,7 @@ func dockerBuildOfficialImage(arch string) error { // Set default Architecture Dockerfile to amd64. dockerfile := "Dockerfile" // Set version of QEMU. - qemuversion := "v5.0.0-2" + qemuversion := "v5.1.0-2" // If not the default value. if arch != defaultArch { diff --git a/cmd/authelia-scripts/main.go b/cmd/authelia-scripts/main.go index 44905e3f4..213595224 100755 --- a/cmd/authelia-scripts/main.go +++ b/cmd/authelia-scripts/main.go @@ -1,5 +1,5 @@ //usr/bin/env go run "$0" "$@"; exit -//nolint:godot +//nolint:gocritic,godot package main diff --git a/internal/authentication/file_user_provider_test.go b/internal/authentication/file_user_provider_test.go index 2d15c7fbc..8c5fc7c05 100644 --- a/internal/authentication/file_user_provider_test.go +++ b/internal/authentication/file_user_provider_test.go @@ -20,17 +20,17 @@ func WithDatabase(content []byte, f func(path string)) { log.Fatal(err) } - defer os.Remove(tmpfile.Name()) // clean up + defer os.Remove(tmpfile.Name()) // Clean up if _, err := tmpfile.Write(content); err != nil { tmpfile.Close() - log.Fatal(err) + log.Panic(err) } f(tmpfile.Name()) if err := tmpfile.Close(); err != nil { - log.Fatal(err) + log.Panic(err) } } diff --git a/internal/configuration/validator/authentication.go b/internal/configuration/validator/authentication.go index 6ac166ea5..b11354f12 100644 --- a/internal/configuration/validator/authentication.go +++ b/internal/configuration/validator/authentication.go @@ -39,7 +39,7 @@ func validateFileAuthenticationBackend(configuration *schema.FileAuthenticationB validator.Push(fmt.Errorf("The number of iterations specified is invalid, must be 1 or more, you configured %d", configuration.Password.Iterations)) } - //Salt Length + // Salt Length switch { case configuration.Password.SaltLength == 0: configuration.Password.SaltLength = schema.DefaultPasswordConfiguration.SaltLength diff --git a/internal/configuration/validator/secrets.go b/internal/configuration/validator/secrets.go index 7ae64575f..cd6305808 100644 --- a/internal/configuration/validator/secrets.go +++ b/internal/configuration/validator/secrets.go @@ -55,7 +55,7 @@ func getSecretValue(name string, validator *schema.StructValidator, viper *viper if err != nil { validator.Push(fmt.Errorf("error loading secret file (%s): %s", name, err)) } else { - return strings.Replace(string(content), "\n", "", -1) + return strings.ReplaceAll(string(content), "\n", "") } } diff --git a/internal/handlers/handler_verify_test.go b/internal/handlers/handler_verify_test.go index a48fbd50a..9f03dedb1 100644 --- a/internal/handlers/handler_verify_test.go +++ b/internal/handlers/handler_verify_test.go @@ -913,7 +913,6 @@ func TestShouldGetRemovedUserGroupsFromBackend(t *testing.T) { func TestShouldGetAddedUserGroupsFromBackend(t *testing.T) { mock := mocks.NewMockAutheliaCtx(t) - //defer mock.Close() // Setup pointer to john so we can adjust it during the test. user := &authentication.UserDetails{ diff --git a/internal/notification/smtp_notifier.go b/internal/notification/smtp_notifier.go index 1a1642df9..a40cf310b 100644 --- a/internal/notification/smtp_notifier.go +++ b/internal/notification/smtp_notifier.go @@ -58,7 +58,7 @@ func (n *SMTPNotifier) initializeTLSConfig() { // The second part of this check happens in the Configure Cert Pool code block log.Debug("Notifier SMTP client initializing TLS configuration") - //Configure Cert Pool + // Configure Cert Pool certPool, err := x509.SystemCertPool() if err != nil || certPool == nil { certPool = x509.NewCertPool() diff --git a/internal/storage/sql_provider_test.go b/internal/storage/sql_provider_test.go index 53957b9ce..6e235b553 100644 --- a/internal/storage/sql_provider_test.go +++ b/internal/storage/sql_provider_test.go @@ -270,7 +270,7 @@ func TestSQLProviderMethodsTOTP(t *testing.T) { WithArgs(args...). WillReturnRows(sqlmock.NewRows([]string{"secret"})) - //Test Blank Rows + // Test Blank Rows secret, err = provider.LoadTOTPSecret(unitTestUser) assert.EqualError(t, err, "No TOTP secret registered") assert.Equal(t, "", secret)