From 0f692b38e25467ed25640a440ac83ac6518e8839 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Wed, 27 Jul 2022 20:03:11 +0800 Subject: [PATCH] makefile: remove useless linter and enable revive for distsql (#36607) --- Makefile | 16 ---------------- build/nogo_config.json | 2 ++ distsql/distsql.go | 1 - distsql/request_builder.go | 13 ++++++------- distsql/select_result.go | 2 +- 5 files changed, 9 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 60175532853e0..3646403e8bafc 100644 --- a/Makefile +++ b/Makefile @@ -43,10 +43,6 @@ goword:tools/bin/goword check-static: tools/bin/golangci-lint GO111MODULE=on CGO_ENABLED=0 tools/bin/golangci-lint run -v $$($(PACKAGE_DIRECTORIES)) --config .golangci.yml -unconvert:tools/bin/unconvert - @echo "unconvert check(skip check the generated or copied code in lightning)" - @GO111MODULE=on tools/bin/unconvert $(UNCONVERT_PACKAGES) - gogenerate: @echo "go generate ./..." ./tools/check/check-gogenerate.sh @@ -211,22 +207,10 @@ tools/bin/xprog: tools/check/xprog.go cd tools/check; \ $(GO) build -o ../bin/xprog xprog.go -tools/bin/megacheck: tools/check/go.mod - cd tools/check; \ - $(GO) build -o ../bin/megacheck honnef.co/go/tools/cmd/megacheck - tools/bin/revive: tools/check/go.mod cd tools/check; \ $(GO) build -o ../bin/revive github.com/mgechev/revive -tools/bin/goword: tools/check/go.mod - cd tools/check; \ - $(GO) build -o ../bin/goword github.com/chzchzchz/goword - -tools/bin/unconvert: tools/check/go.mod - cd tools/check; \ - $(GO) build -o ../bin/unconvert github.com/mdempsky/unconvert - tools/bin/failpoint-ctl: tools/check/go.mod cd tools/check; \ $(GO) build -o ../bin/failpoint-ctl github.com/pingcap/failpoint/failpoint-ctl diff --git a/build/nogo_config.json b/build/nogo_config.json index babbe26a4e3ac..7dfbc3e5e3382 100644 --- a/build/nogo_config.json +++ b/build/nogo_config.json @@ -244,6 +244,8 @@ ".*_generated\\.go$": "ignore generated code" }, "only_files": { + "planner/core/rule_partition_eliminate.go": "planner/core/rule_partition_eliminate code", + "distsql/": "ignore distsql code", "dumpling/export": "dumpling/export code", "lock/": "lock file", "errno/": "errno code", diff --git a/distsql/distsql.go b/distsql/distsql.go index add2d57bd0b20..27610b9a1bf43 100644 --- a/distsql/distsql.go +++ b/distsql/distsql.go @@ -58,7 +58,6 @@ func DispatchMPPTasks(ctx context.Context, sctx sessionctx.Context, tasks []*kv. rootPlanID: rootID, storeType: kv.TiFlash, }, nil - } // Select sends a DAG request, returns SelectResult. diff --git a/distsql/request_builder.go b/distsql/request_builder.go index 773319f27f847..bd55fadc244f6 100644 --- a/distsql/request_builder.go +++ b/distsql/request_builder.go @@ -218,20 +218,19 @@ func (builder *RequestBuilder) SetAllowBatchCop(batchCop bool) *RequestBuilder { } // SetPartitionIDAndRanges sets `PartitionIDAndRanges` property. -func (builder *RequestBuilder) SetPartitionIDAndRanges(PartitionIDAndRanges []kv.PartitionIDAndRanges) *RequestBuilder { - builder.PartitionIDAndRanges = PartitionIDAndRanges +func (builder *RequestBuilder) SetPartitionIDAndRanges(partitionIDAndRanges []kv.PartitionIDAndRanges) *RequestBuilder { + builder.PartitionIDAndRanges = partitionIDAndRanges return builder } func (builder *RequestBuilder) getIsolationLevel() kv.IsoLevel { - switch builder.Tp { - case kv.ReqTypeAnalyze: + if builder.Tp == kv.ReqTypeAnalyze { return kv.RC } return kv.SI } -func (builder *RequestBuilder) getKVPriority(sv *variable.SessionVars) int { +func (*RequestBuilder) getKVPriority(sv *variable.SessionVars) int { switch sv.StmtCtx.Priority { case mysql.NoPriority, mysql.DelayedPriority: return kv.PriorityNormal @@ -689,7 +688,7 @@ func VerifyTxnScope(txnScope string, physicalTableID int64, is infoschema.InfoSc func indexRangesToKVWithoutSplit(sc *stmtctx.StatementContext, tids []int64, idxID int64, ranges []*ranger.Range, memTracker *memory.Tracker, interruptSignal *atomic.Value) ([]kv.KeyRange, error) { krs := make([]kv.KeyRange, 0, len(ranges)) - const CheckSignalStep = 8 + const checkSignalStep = 8 var estimatedMemUsage int64 // encodeIndexKey and EncodeIndexSeekKey is time-consuming, thus we need to // check the interrupt signal periodically. @@ -709,7 +708,7 @@ func indexRangesToKVWithoutSplit(sc *stmtctx.StatementContext, tids []int64, idx } krs = append(krs, kv.KeyRange{StartKey: startKey, EndKey: endKey}) } - if i%CheckSignalStep == 0 { + if i%checkSignalStep == 0 { if i == 0 && memTracker != nil { estimatedMemUsage *= int64(len(ranges)) memTracker.Consume(estimatedMemUsage) diff --git a/distsql/select_result.go b/distsql/select_result.go index ffcf846643c68..adc8decb3a4ed 100644 --- a/distsql/select_result.go +++ b/distsql/select_result.go @@ -618,6 +618,6 @@ func (s *selectResultRuntimeStats) String() string { } // Tp implements the RuntimeStats interface. -func (s *selectResultRuntimeStats) Tp() int { +func (*selectResultRuntimeStats) Tp() int { return execdetails.TpSelectResultRuntimeStats }