Skip to content

Commit

Permalink
*: Fixed some linter check errors (pingcap#25608)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsqlu authored Jun 26, 2021
1 parent 9e8bb50 commit a9daa4a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions executor/analyze_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ func (s *testSuite1) TestAnalyzeIncrementalStreaming(c *C) {
s.testAnalyzeIncremental(tk, c)
}

// nolint:unused
func (s *testSuite1) testAnalyzeIncremental(tk *testkit.TestKit, c *C) {
tk.MustExec("use test")
tk.MustExec("drop table if exists t")
Expand Down
1 change: 1 addition & 0 deletions executor/distsql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/pingcap/tidb/util/testkit"
)

// nolint:unused
func checkGoroutineExists(keyword string) bool {
buf := new(bytes.Buffer)
profile := pprof.Lookup("goroutine")
Expand Down
2 changes: 2 additions & 0 deletions executor/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,14 @@ func (s *testMemoryLeak) TestPBMemoryLeak(c *C) {
c.Assert(s.memDiff(inUseFinal, inUseAfter), Less, delta)
}

// nolint:unused
func (s *testMemoryLeak) readMem() (allocated, heapInUse uint64) {
var stat runtime.MemStats
runtime.ReadMemStats(&stat)
return stat.TotalAlloc, stat.HeapInuse
}

// nolint:unused
func (s *testMemoryLeak) memDiff(m1, m2 uint64) uint64 {
if m1 > m2 {
return m1 - m2
Expand Down
1 change: 1 addition & 0 deletions planner/core/prepare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ func (s *testPrepareSerialSuite) TestPrepareTableAsNameOnGroupByWithCache(c *C)
tk.MustQuery("execute stmt").Sort().Check(testkit.Rows("partner1", "partner2", "partner3", "partner4"))
}

// nolint:unused
func readGaugeInt(g prometheus.Gauge) int {
ch := make(chan prometheus.Metric, 1)
g.Collect(ch)
Expand Down
3 changes: 3 additions & 0 deletions statistics/handle/handle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ func (s *testStatsSuite) TestBuildGlobalLevelStats(c *C) {
c.Assert(len(result.Rows()), Equals, 20)
}

// nolint:unused
func (s *testStatsSuite) prepareForGlobalStatsWithOpts(c *C, tk *testkit.TestKit, tblName, dbName string) {
tk.MustExec("create database if not exists " + dbName)
tk.MustExec("use " + dbName)
Expand All @@ -870,6 +871,7 @@ func (s *testStatsSuite) prepareForGlobalStatsWithOpts(c *C, tk *testkit.TestKit
c.Assert(s.do.StatsHandle().DumpStatsDeltaToKV(handle.DumpAll), IsNil)
}

// nolint:unused
func (s *testStatsSuite) checkForGlobalStatsWithOpts(c *C, tk *testkit.TestKit, p string, topn, buckets int) {
delta := buckets/2 + 1
for _, isIdx := range []int{0, 1} {
Expand All @@ -890,6 +892,7 @@ func (s *testStatsSuite) TestAnalyzeGlobalStatsWithOpts(c *C) {
tk := testkit.NewTestKit(c, s.store)
s.prepareForGlobalStatsWithOpts(c, tk, "test_gstats_opt", "test_gstats_opt")

// nolint:unused
type opt struct {
topn int
buckets int
Expand Down
1 change: 1 addition & 0 deletions structure/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (t *TxStructure) encodeStringDataKey(key []byte) kv.Key {
return codec.EncodeUint(ek, uint64(StringData))
}

// nolint:unused
func (t *TxStructure) encodeHashMetaKey(key []byte) kv.Key {
ek := make([]byte, 0, len(t.prefix)+codec.EncodedBytesLength(len(key))+8)
ek = append(ek, t.prefix...)
Expand Down

0 comments on commit a9daa4a

Please sign in to comment.