From 5af39c30d4566795b9e83308825f1a2d7d96d8af Mon Sep 17 00:00:00 2001 From: Youyuan Wu Date: Sat, 5 Feb 2022 11:14:02 -0800 Subject: [PATCH] Fix linter warnings Signed-off-by: Youyuan Wu --- .golangci.yml | 2 ++ date_test.go | 1 + format.go | 1 + time_test.go | 1 + ulid_test.go | 1 + 5 files changed, 6 insertions(+) diff --git a/.golangci.yml b/.golangci.yml index 7ffaa32..da12d5e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -35,6 +35,8 @@ linters: - godot - exhaustivestruct - paralleltest + - varnamelen + - ireturn #- thelper issues: diff --git a/date_test.go b/date_test.go index 77b00ed..7d86989 100644 --- a/date_test.go +++ b/date_test.go @@ -168,6 +168,7 @@ func TestDate_Equal(t *testing.T) { d2 := Date(time.Date(2020, 10, 11, 12, 13, 14, 15, time.UTC)) d3 := Date(time.Date(2020, 11, 12, 13, 14, 15, 16, time.UTC)) + //nolint:gocritic assert.True(t, d1.Equal(d1), "Same Date should Equal itself") assert.True(t, d1.Equal(d2), "Date instances should be equal") assert.False(t, d1.Equal(d3), "Date instances should not be equal") diff --git a/format.go b/format.go index 602e478..172055d 100644 --- a/format.go +++ b/format.go @@ -76,6 +76,7 @@ type defaultFormats struct { // NewFormats creates a new formats registry seeded with the values from the default func NewFormats() Registry { + //nolint:forcetypeassert return NewSeededFormats(Default.(*defaultFormats).data, nil) } diff --git a/time_test.go b/time_test.go index 206e7ca..c1a96c0 100644 --- a/time_test.go +++ b/time_test.go @@ -320,6 +320,7 @@ func TestDateTime_Equal(t *testing.T) { dt1 := DateTime(time.Now()) dt2 := DateTime(time.Time(dt1).Add(time.Second)) + //nolint:gocritic assert.True(t, dt1.Equal(dt1), "DateTime instances should be equal") assert.False(t, dt1.Equal(dt2), "DateTime instances should not be equal") } diff --git a/ulid_test.go b/ulid_test.go index afa46b5..6f3f9b6 100644 --- a/ulid_test.go +++ b/ulid_test.go @@ -299,6 +299,7 @@ func TestFormatULID_NewULID_and_Equal(t *testing.T) { ulid2, err := NewULID() assert.NoError(t, err) + //nolint:gocritic assert.True(t, ulid1.Equal(ulid1), "ULID instances should be equal") assert.False(t, ulid1.Equal(ulid2), "ULID instances should not be equal")