From 634d6176d4d29384c4298af89909bd482cca419e Mon Sep 17 00:00:00 2001 From: vincentysc Date: Mon, 25 Nov 2024 12:17:23 +0800 Subject: [PATCH] fix lint --- external/json/numeric_string.go | 2 +- external/json/uint32.go | 2 +- external/utctime/utctime.go | 2 +- projection/chainstats/chainstats_test.go | 9 +++++---- usecase/coin/uint.go | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/external/json/numeric_string.go b/external/json/numeric_string.go index d0fb7b318..b9713d062 100644 --- a/external/json/numeric_string.go +++ b/external/json/numeric_string.go @@ -33,7 +33,7 @@ func (u NumericString) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf("\"%s\"", u.String())), nil } -func (u *NumericString) UnmarshalJSON(data []byte) error { +func (u NumericString) UnmarshalJSON(data []byte) error { var untypedVal interface{} if err := jsoniter.Unmarshal(data, &untypedVal); err != nil { return err diff --git a/external/json/uint32.go b/external/json/uint32.go index 7b2ad2e48..478018bc1 100644 --- a/external/json/uint32.go +++ b/external/json/uint32.go @@ -26,7 +26,7 @@ func (u Uint32) MarshalJSON() ([]byte, error) { return []byte(u.String()), nil } -func (u *Uint32) UnmarshalJSON(data []byte) error { +func (u Uint32) UnmarshalJSON(data []byte) error { // Ignore null, like in the main JSON package. if string(data) == "null" { return nil diff --git a/external/utctime/utctime.go b/external/utctime/utctime.go index a458079ef..f39cad10d 100644 --- a/external/utctime/utctime.go +++ b/external/utctime/utctime.go @@ -128,7 +128,7 @@ func (t UTCTime) MarshalJSON() ([]byte, error) { return result, nil } -func (t *UTCTime) UnmarshalJSON(data []byte) error { +func (t UTCTime) UnmarshalJSON(data []byte) error { var timeVal gotime.Time if err := jsoniter.Unmarshal(data, &timeVal); err != nil { return err diff --git a/projection/chainstats/chainstats_test.go b/projection/chainstats/chainstats_test.go index 9d2940403..acf31fc7d 100644 --- a/projection/chainstats/chainstats_test.go +++ b/projection/chainstats/chainstats_test.go @@ -1,11 +1,12 @@ package chainstats_test import ( - "github.com/crypto-com/chain-indexing/usecase/model/genesis" "path" "runtime" "time" + "github.com/crypto-com/chain-indexing/usecase/model/genesis" + . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -33,14 +34,14 @@ var _ = Describe("Chain Stats", func() { Describe("genesis time parsing learning test", func() { It("should parse correctly different variations of time format", func() { Expect( - utctime.MustParse(time.RFC3339, "2021-03-25T01:00:00Z").UnixNano(), + utctime.MustParse(time.RFC3339, "2021-03-25T01:00:00Z"), ).To(Equal(int64(1616634000000000000))) Expect( - utctime.MustParse("2006-01-02T15:04:05.000000Z", "2020-12-23T07:30:28.674523Z").UnixNano(), + utctime.MustParse("2006-01-02T15:04:05.000000Z", "2020-12-23T07:30:28.674523Z"), ).To(Equal(int64(1608708628674523000))) Expect( - utctime.MustParse(time.RFC3339, "2020-12-23T07:30:28.674523Z").UnixNano(), + utctime.MustParse(time.RFC3339, "2020-12-23T07:30:28.674523Z"), ).To(Equal(int64(1608708628674523000))) }) }) diff --git a/usecase/coin/uint.go b/usecase/coin/uint.go index bf1db39b1..221297b2b 100644 --- a/usecase/coin/uint.go +++ b/usecase/coin/uint.go @@ -141,7 +141,7 @@ func (u Uint) MarshalJSON() ([]byte, error) { } // UnmarshalJSON defines custom decoding scheme -func (u *Uint) UnmarshalJSON(bz []byte) error { +func (u Uint) UnmarshalJSON(bz []byte) error { if u.i == nil { // Necessary since default Uint initialization has i.i as nil u.i = new(big.Int) }