From e693302c752564c8c3f5fbcc651a2e377ec39a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Michaud?= Date: Wed, 4 Aug 2021 01:36:53 +0200 Subject: [PATCH] fix(storage): use lower case in error messages (#2145) Co-authored-by: James Elliott Co-authored-by: Amir Zarrinkafsh --- internal/storage/errors.go | 4 ++-- internal/storage/sql_provider_test.go | 4 ++-- internal/storage/upgrades.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/storage/errors.go b/internal/storage/errors.go index 30384e21..7cf6e8c0 100644 --- a/internal/storage/errors.go +++ b/internal/storage/errors.go @@ -4,8 +4,8 @@ import "errors" var ( // ErrNoU2FDeviceHandle error thrown when no U2F device handle has been found in DB. - ErrNoU2FDeviceHandle = errors.New("No U2F device handle found") + ErrNoU2FDeviceHandle = errors.New("no U2F device handle found") // ErrNoTOTPSecret error thrown when no TOTP secret has been found in DB. - ErrNoTOTPSecret = errors.New("No TOTP secret registered") + ErrNoTOTPSecret = errors.New("no TOTP secret registered") ) diff --git a/internal/storage/sql_provider_test.go b/internal/storage/sql_provider_test.go index 6e235b55..9a71b743 100644 --- a/internal/storage/sql_provider_test.go +++ b/internal/storage/sql_provider_test.go @@ -272,7 +272,7 @@ func TestSQLProviderMethodsTOTP(t *testing.T) { // Test Blank Rows secret, err = provider.LoadTOTPSecret(unitTestUser) - assert.EqualError(t, err, "No TOTP secret registered") + assert.EqualError(t, err, "no TOTP secret registered") assert.Equal(t, "", secret) } @@ -332,7 +332,7 @@ func TestSQLProviderMethodsU2F(t *testing.T) { WillReturnRows(sqlmock.NewRows([]string{"keyHandle", "publicKey"})) keyHandle, publicKey, err = provider.LoadU2FDeviceHandle(unitTestUser) - assert.EqualError(t, err, "No U2F device handle found") + assert.EqualError(t, err, "no U2F device handle found") assert.Equal(t, []byte(nil), keyHandle) assert.Equal(t, []byte(nil), publicKey) } diff --git a/internal/storage/upgrades.go b/internal/storage/upgrades.go index 25ee12fe..ec93f3e3 100644 --- a/internal/storage/upgrades.go +++ b/internal/storage/upgrades.go @@ -19,7 +19,7 @@ func (p *SQLProvider) upgradeCreateTableStatements(tx transaction, statements ma if !utils.IsStringInSlice(table, existingTables) { _, err := tx.Exec(fmt.Sprintf(statements[table], table)) if err != nil { - return fmt.Errorf("Unable to create table %s: %v", table, err) + return fmt.Errorf("unable to create table %s: %v", table, err) } } } @@ -63,7 +63,7 @@ func (p *SQLProvider) upgradeSchemaToVersion001(tx transaction, tables []string) if p.name != "mysql" { err = p.upgradeRunMultipleStatements(tx, p.sqlUpgradesCreateTableIndexesStatements[1]) if err != nil { - return fmt.Errorf("Unable to create index: %v", err) + return fmt.Errorf("unable to create index: %v", err) } }