From 5d6c20ca92a0c80bacba6a6717973209cf30d927 Mon Sep 17 00:00:00 2001 From: Jay Janssen Date: Thu, 27 Jun 2024 14:28:42 -0400 Subject: [PATCH] linter fixes --- pkg/check/tablename.go | 3 ++- pkg/check/tablename_test.go | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/check/tablename.go b/pkg/check/tablename.go index d2a65fd..4c62205 100644 --- a/pkg/check/tablename.go +++ b/pkg/check/tablename.go @@ -2,6 +2,7 @@ package check import ( "context" + "errors" "fmt" "strings" @@ -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 diff --git a/pkg/check/tablename_test.go b/pkg/check/tablename_test.go index 2c2516d..f5dc56b 100644 --- a/pkg/check/tablename_test.go +++ b/pkg/check/tablename_test.go @@ -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) @@ -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") - }