Skip to content

Commit

Permalink
*: adopt the latest golangci-lint (#7850)
Browse files Browse the repository at this point in the history
ref #4399

Adopt the latest golangci-lint version and check.

Signed-off-by: JmPotato <[email protected]>
  • Loading branch information
JmPotato committed Feb 23, 2024
1 parent cd85c24 commit 6822137
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
7 changes: 5 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ linters-settings:
- require-error
- suite-dont-use-pkg
- suite-extra-assert-call
disable:
- float-compare
- go-require
gofmt:
# https://golangci-lint.run/usage/linters/#gofmt
# disable for faster check
simplify: false
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'
- pattern: "interface{}"
replacement: "any"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ SHELL := env PATH='$(PATH)' GOBIN='$(GO_TOOLS_BIN_PATH)' $(shell which bash)

install-tools:
@mkdir -p $(GO_TOOLS_BIN_PATH)
@which golangci-lint >/dev/null 2>&1 || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_TOOLS_BIN_PATH) v1.55.2
@which golangci-lint >/dev/null 2>&1 || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_TOOLS_BIN_PATH) v1.56.2
@grep '_' tools.go | sed 's/"//g' | awk '{print $$2}' | xargs go install

.PHONY: install-tools
Expand Down
12 changes: 6 additions & 6 deletions pkg/core/storelimit/limit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,18 @@ func TestWindow(t *testing.T) {
token := capacity + 10
re.True(s.take(token))
re.False(s.take(token))
re.EqualValues(s.ack(token), 0)
re.EqualValues(0, s.ack(token))
re.True(s.take(token))
re.EqualValues(s.ack(token), 0)
re.EqualValues(0, s.ack(token))
re.Equal(s.ack(token), token)
re.EqualValues(s.getUsed(), 0)
re.EqualValues(0, s.getUsed())

// case2: the capacity of the window must greater than the minSnapSize.
s.reset(minSnapSize - 1)
re.EqualValues(s.capacity, minSnapSize)
re.EqualValues(minSnapSize, s.capacity)
re.True(s.take(minSnapSize))
re.EqualValues(s.ack(minSnapSize*2), minSnapSize)
re.EqualValues(s.getUsed(), 0)
re.EqualValues(minSnapSize, s.ack(minSnapSize*2))
re.EqualValues(0, s.getUsed())
}

func TestFeedback(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/typeutil/clone_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ func TestDeepClone(t *testing.T) {
re := assert.New(t)
src := &fate{ID: 1}
dst := DeepClone(src, fateFactory)
re.EqualValues(dst.ID, 1)
re.EqualValues(1, dst.ID)
dst.ID = 2
re.EqualValues(src.ID, 1)
re.EqualValues(1, src.ID)

// case2: the source is nil
var src2 *fate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ func (suite *resourceManagerClientTestSuite) TestResourcePenalty() {
_, penalty, _, _, err = c.OnRequestWait(suite.ctx, resourceGroupName, req2)
re.NoError(err)
re.Equal(60.0, penalty.WriteBytes)
re.InEpsilon(penalty.TotalCpuTimeMs, 10.0/1000.0/1000.0, 1e-6)
re.InEpsilon(10.0/1000.0/1000.0, penalty.TotalCpuTimeMs, 1e-6)
_, err = c.OnResponse(resourceGroupName, req2, resp2)
re.NoError(err)

Expand Down

0 comments on commit 6822137

Please sign in to comment.