diff --git a/internal/configuration/validator/authentication_test.go b/internal/configuration/validator/authentication_test.go index 95c2016b0..5b4477e35 100644 --- a/internal/configuration/validator/authentication_test.go +++ b/internal/configuration/validator/authentication_test.go @@ -334,7 +334,7 @@ func (suite *LDAPAuthenticationBackendSuite) TestShouldRaiseOnBadRefreshInterval suite.Assert().False(suite.validator.HasWarnings()) suite.Require().Len(suite.validator.Errors(), 1) - suite.Assert().EqualError(suite.validator.Errors()[0], "Auth Backend `refresh_interval` is configured to 'blah' but it must be either a duration notation or one of 'disable', or 'always'. Error from parser: Could not convert the input string of blah into a duration") + suite.Assert().EqualError(suite.validator.Errors()[0], "Auth Backend `refresh_interval` is configured to 'blah' but it must be either a duration notation or one of 'disable', or 'always'. Error from parser: could not convert the input string of blah into a duration") } func (suite *LDAPAuthenticationBackendSuite) TestShouldSetDefaultImplementation() { diff --git a/internal/configuration/validator/regulation_test.go b/internal/configuration/validator/regulation_test.go index f30228df5..120d5983f 100644 --- a/internal/configuration/validator/regulation_test.go +++ b/internal/configuration/validator/regulation_test.go @@ -54,6 +54,6 @@ func TestShouldRaiseErrorOnBadDurationStrings(t *testing.T) { ValidateRegulation(&config, validator) assert.Len(t, validator.Errors(), 2) - assert.EqualError(t, validator.Errors()[0], "Error occurred parsing regulation find_time string: Could not convert the input string of a year into a duration") - assert.EqualError(t, validator.Errors()[1], "Error occurred parsing regulation ban_time string: Could not convert the input string of forever into a duration") + assert.EqualError(t, validator.Errors()[0], "Error occurred parsing regulation find_time string: could not convert the input string of a year into a duration") + assert.EqualError(t, validator.Errors()[1], "Error occurred parsing regulation ban_time string: could not convert the input string of forever into a duration") } diff --git a/internal/configuration/validator/session_test.go b/internal/configuration/validator/session_test.go index 15bb37d62..9b78bfd1c 100644 --- a/internal/configuration/validator/session_test.go +++ b/internal/configuration/validator/session_test.go @@ -430,8 +430,8 @@ func TestShouldRaiseErrorWhenBadInactivityAndExpirationSet(t *testing.T) { assert.False(t, validator.HasWarnings()) assert.Len(t, validator.Errors(), 2) - assert.EqualError(t, validator.Errors()[0], "Error occurred parsing session expiration string: Could not convert the input string of -1 into a duration") - assert.EqualError(t, validator.Errors()[1], "Error occurred parsing session inactivity string: Could not convert the input string of -1 into a duration") + assert.EqualError(t, validator.Errors()[0], "Error occurred parsing session expiration string: could not convert the input string of -1 into a duration") + assert.EqualError(t, validator.Errors()[1], "Error occurred parsing session inactivity string: could not convert the input string of -1 into a duration") } func TestShouldRaiseErrorWhenBadRememberMeDurationSet(t *testing.T) { @@ -443,7 +443,7 @@ func TestShouldRaiseErrorWhenBadRememberMeDurationSet(t *testing.T) { assert.False(t, validator.HasWarnings()) assert.Len(t, validator.Errors(), 1) - assert.EqualError(t, validator.Errors()[0], "Error occurred parsing session remember_me_duration string: Could not convert the input string of 1 year into a duration") + assert.EqualError(t, validator.Errors()[0], "Error occurred parsing session remember_me_duration string: could not convert the input string of 1 year into a duration") } func TestShouldSetDefaultRememberMeDuration(t *testing.T) { diff --git a/internal/utils/check.go b/internal/utils/check.go index bd2c4211b..dbc63196f 100644 --- a/internal/utils/check.go +++ b/internal/utils/check.go @@ -19,7 +19,7 @@ func CheckUntil(interval time.Duration, timeout time.Duration, predicate func() return err } case <-time.After(timeout): - return fmt.Errorf("Timeout of %ds reached", int64(timeout/time.Second)) + return fmt.Errorf("timeout of %ds reached", int64(timeout/time.Second)) } } } diff --git a/internal/utils/exec.go b/internal/utils/exec.go index 7cfad8ea6..fbc743207 100644 --- a/internal/utils/exec.go +++ b/internal/utils/exec.go @@ -179,5 +179,5 @@ func RunFuncWithRetry(attempts int, sleep time.Duration, f func() error) (err er log.Printf("Retrying after error: %s", err) } - return fmt.Errorf("Failed after %d attempts, last error: %s", attempts, err) + return fmt.Errorf("failed after %d attempts, last error: %s", attempts, err) } diff --git a/internal/utils/rsa.go b/internal/utils/rsa.go index cc5a09d65..9718ebef4 100644 --- a/internal/utils/rsa.go +++ b/internal/utils/rsa.go @@ -79,5 +79,5 @@ func ParseRsaPublicKeyFromPemStr(pubPEM string) (*rsa.PublicKey, error) { break // fall through } - return nil, errors.New("Key type is not RSA") + return nil, errors.New("key type is not RSA") } diff --git a/internal/utils/time.go b/internal/utils/time.go index 8c05dbc31..87628741e 100644 --- a/internal/utils/time.go +++ b/internal/utils/time.go @@ -38,13 +38,13 @@ func ParseDurationString(input string) (time.Duration, error) { case input == "0" || len(matches) == 3: seconds, err := strconv.Atoi(input) if err != nil { - return 0, fmt.Errorf("Could not convert the input string of %s into a duration: %s", input, err) + return 0, fmt.Errorf("could not convert the input string of %s into a duration: %s", input, err) } duration = time.Duration(seconds) * time.Second case input != "": // Throw this error if input is anything other than a blank string, blank string will default to a duration of nothing - return 0, fmt.Errorf("Could not convert the input string of %s into a duration", input) + return 0, fmt.Errorf("could not convert the input string of %s into a duration", input) } return duration, nil diff --git a/internal/utils/time_test.go b/internal/utils/time_test.go index 438a0c234..a4104720b 100644 --- a/internal/utils/time_test.go +++ b/internal/utils/time_test.go @@ -47,25 +47,25 @@ func TestShouldParseSecondsString(t *testing.T) { func TestShouldNotParseDurationStringWithOutOfOrderQuantitiesAndUnits(t *testing.T) { duration, err := ParseDurationString("h1") - assert.EqualError(t, err, "Could not convert the input string of h1 into a duration") + assert.EqualError(t, err, "could not convert the input string of h1 into a duration") assert.Equal(t, time.Duration(0), duration) } func TestShouldNotParseBadDurationString(t *testing.T) { duration, err := ParseDurationString("10x") - assert.EqualError(t, err, "Could not convert the input string of 10x into a duration") + assert.EqualError(t, err, "could not convert the input string of 10x into a duration") assert.Equal(t, time.Duration(0), duration) } func TestShouldNotParseDurationStringWithMultiValueUnits(t *testing.T) { duration, err := ParseDurationString("10ms") - assert.EqualError(t, err, "Could not convert the input string of 10ms into a duration") + assert.EqualError(t, err, "could not convert the input string of 10ms into a duration") assert.Equal(t, time.Duration(0), duration) } func TestShouldNotParseDurationStringWithLeadingZero(t *testing.T) { duration, err := ParseDurationString("005h") - assert.EqualError(t, err, "Could not convert the input string of 005h into a duration") + assert.EqualError(t, err, "could not convert the input string of 005h into a duration") assert.Equal(t, time.Duration(0), duration) }