Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jayjanssen committed Jun 27, 2024
1 parent 5fdeb6d commit 5d6c20c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pkg/check/tablename.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package check

import (
"context"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -46,7 +47,7 @@ func init() {
func tableNameCheck(ctx context.Context, r Resources, logger loggers.Advanced) error {
tableName := r.Table.TableName
if len(tableName) < 1 {
return fmt.Errorf("table name must be at least 1 character")
return errors.New("table name must be at least 1 character")
}

timestampTableNameLength := maxTableNameLength - NameFormatTimestampExtraChars
Expand Down
5 changes: 2 additions & 3 deletions pkg/check/tablename_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

func TestCheckTableNameConstants(t *testing.T) {
// Calculated extra chars should always be greater than 0
assert.Greater(t, NameFormatNormalExtraChars, 0)
assert.Greater(t, NameFormatTimestampExtraChars, 0)
assert.Positive(t, NameFormatNormalExtraChars)
assert.Positive(t, NameFormatTimestampExtraChars)

// Calculated extra chars should be less than the max table name length
assert.Less(t, NameFormatNormalExtraChars, maxTableNameLength)
Expand All @@ -39,5 +39,4 @@ func TestCheckTableName(t *testing.T) {
longName := "thisisareallylongtablenamethisisareallylongtablenamethisisareallylongtablename"
assert.ErrorContains(t, testTableName(longName, false), "table name must be less than")
assert.ErrorContains(t, testTableName(longName, true), "table name must be less than")

}

0 comments on commit 5d6c20c

Please sign in to comment.