diff --git a/Makefile b/Makefile index ef15f22e67..6a1111df1f 100644 --- a/Makefile +++ b/Makefile @@ -42,9 +42,9 @@ lint: ruleguard: @echo "Running $@ check" - @${GOPATH}/bin/ruleguard -rules ruleguard.rules.go ./internal/... || true - @${GOPATH}/bin/ruleguard -rules ruleguard.rules.go ./cmd/... || true - @${GOPATH}/bin/ruleguard -rules ruleguard.rules.go ./test/... || true + @${GOPATH}/bin/ruleguard -rules ruleguard.rules.go ./internal/... + @${GOPATH}/bin/ruleguard -rules ruleguard.rules.go ./cmd/... + @${GOPATH}/bin/ruleguard -rules ruleguard.rules.go ./test/... verifiers: get-check-deps fmt lint ruleguard diff --git a/internal/master/tso/global_allocator.go b/internal/master/tso/global_allocator.go index ea0c697c30..5c94acb6fd 100644 --- a/internal/master/tso/global_allocator.go +++ b/internal/master/tso/global_allocator.go @@ -87,7 +87,7 @@ func (gta *GlobalTSOAllocator) GenerateTSO(count uint32) (uint64, error) { for i := 0; i < maxRetryCount; i++ { current := (*atomicObject)(atomic.LoadPointer(>a.tso.TSO)) - if current == nil || current.physical == typeutil.ZeroTime { + if current == nil || current.physical.Equal(typeutil.ZeroTime) { // If it's leader, maybe SyncTimestamp hasn't completed yet log.Println("sync hasn't completed yet, wait for a while") time.Sleep(200 * time.Millisecond) diff --git a/internal/master/tso/global_allocator_test.go b/internal/master/tso/global_allocator_test.go index 72e4711696..9db77177e6 100644 --- a/internal/master/tso/global_allocator_test.go +++ b/internal/master/tso/global_allocator_test.go @@ -35,7 +35,7 @@ func TestGlobalTSOAllocator_GenerateTSO(t *testing.T) { for i := 0; i < count; i++ { ts, _ := GTsoAllocator.GenerateTSO(perCount) physical, logical := tsoutil.ParseTS(ts) - if lastPhysical == physical { + if lastPhysical.Equal(physical) { diff := logical - lastLogical assert.Equal(t, uint64(perCount), diff) } diff --git a/internal/proxy/timetick_test.go b/internal/proxy/timetick_test.go index a78894ecf8..ab092077a5 100644 --- a/internal/proxy/timetick_test.go +++ b/internal/proxy/timetick_test.go @@ -76,7 +76,7 @@ func TestTimeTick(t *testing.T) { return } if tsm.Timestamp <= lastTimestamp { - t.Fatalf("current = %d, last = %d", uint64(tsm.Timestamp), uint64(lastTimestamp)) + t.Fatalf("current = %d, last = %d", tsm.Timestamp, lastTimestamp) } t.Log("current = ", tsm.Timestamp) lastTimestamp = tsm.Timestamp diff --git a/internal/util/flowgraph/flow_graph_test.go b/internal/util/flowgraph/flow_graph_test.go index 0aa4ff9aff..9f170eb2bb 100644 --- a/internal/util/flowgraph/flow_graph_test.go +++ b/internal/util/flowgraph/flow_graph_test.go @@ -137,7 +137,7 @@ func sendMsgFromCmd(ctx context.Context, fg *TimeTickedFlowGraph) { return } // assert result - if res != math.Pow(num, 2)+math.Sqrt(num) { + if res-(math.Pow(num, 2)+math.Sqrt(num)) > 0.000001 { fmt.Println(res) fmt.Println(math.Pow(num, 2) + math.Sqrt(num)) panic("wrong answer")