Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linter: fix linter error when make dev locally #25661

Merged
merged 6 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ddl/column_type_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@ func (s *testColumnTypeChangeSuite) TestChangingColOriginDefaultValueAfterAddCol
tk1 := testkit.NewTestKit(c, s.store)
tk1.MustExec("use test")

tk.MustExec(fmt.Sprintf("set time_zone = 'UTC'"))
tk.MustExec("set time_zone = 'UTC'")
tk.MustExec("drop table if exists t")
tk.MustExec("create table t(a VARCHAR(31) NULL DEFAULT 'wwrzfwzb01j6ddj', b DECIMAL(12,0) NULL DEFAULT '-729850476163')")
tk.MustExec("ALTER TABLE t ADD COLUMN x CHAR(218) NULL DEFAULT 'lkittuae'")
Expand Down
4 changes: 2 additions & 2 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2791,7 +2791,7 @@ func (b *executorBuilder) buildTableReader(v *plannercore.PhysicalTableReader) E
if !b.ctx.GetSessionVars().UseDynamicPartitionPrune() {
return ret
}
// When isPartition is set, it means the union rewriting is done, so a partition reader is prefered.
// When isPartition is set, it means the union rewriting is done, so a partition reader is preferred.
if ok, _ := ts.IsPartition(); ok {
return ret
}
Expand Down Expand Up @@ -3020,7 +3020,7 @@ func (b *executorBuilder) buildIndexReader(v *plannercore.PhysicalIndexReader) E
if !b.ctx.GetSessionVars().UseDynamicPartitionPrune() {
return ret
}
// When isPartition is set, it means the union rewriting is done, so a partition reader is prefered.
// When isPartition is set, it means the union rewriting is done, so a partition reader is preferred.
if ok, _ := is.IsPartition(); ok {
return ret
}
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ require (
golang.org/x/tools v0.1.0
google.golang.org/grpc v1.27.1
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
honnef.co/go/tools v0.2.0 // indirect
modernc.org/mathutil v1.2.2 // indirect
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67
Expand Down
1 change: 0 additions & 1 deletion planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3634,7 +3634,6 @@ func (ds *DataSource) addExtraPIDColumn(info *extraPIDInfo) {

info.Columns = append(info.Columns, pidCol)
info.TblIDs = append(info.TblIDs, ds.TableInfo().ID)
return
}

var (
Expand Down
3 changes: 3 additions & 0 deletions planner/core/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ const (
inSequenceFunction
)

// Make linter happy.
var _ = PreprocessorReturn{}.initedLastSnapshotTS

// PreprocessorReturn is used to retain information obtained in the preprocessor.
type PreprocessorReturn struct {
initedLastSnapshotTS bool
Expand Down
15 changes: 9 additions & 6 deletions server/tidb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ func (ts *tidbTestTopSQLSuite) TestTopSQLAgent(c *C) {
cancel() // cancel case 1

// case 2: agent hangs for a while
cancel = runWorkload(0, 10)
cancel2 := runWorkload(0, 10)
// empty agent address, should not collect records
dbt.mustExec("set @@global.tidb_top_sql_max_statement_count=5;")
dbt.mustExec("set @@tidb_top_sql_agent_address='';")
Expand All @@ -1508,13 +1508,15 @@ func (ts *tidbTestTopSQLSuite) TestTopSQLAgent(c *C) {
// agent server hangs for a while
agentServer.HangFromNow(time.Second * 6)
// run another set of SQL queries
cancel()
cancel = runWorkload(11, 20)
cancel2()

cancel3 := runWorkload(11, 20)
agentServer.WaitCollectCnt(1, time.Second*8)
checkFn(5)
cancel3()

// case 3: agent restart
cancel = runWorkload(0, 10)
cancel4 := runWorkload(0, 10)
// empty agent address, should not collect records
dbt.mustExec("set @@tidb_top_sql_agent_address='';")
agentServer.WaitCollectCnt(1, time.Second*4)
Expand All @@ -1524,9 +1526,9 @@ func (ts *tidbTestTopSQLSuite) TestTopSQLAgent(c *C) {
agentServer.WaitCollectCnt(1, time.Second*8)
checkFn(5)
// run another set of SQL queries
cancel()
cancel4()

cancel = runWorkload(11, 20)
cancel5 := runWorkload(11, 20)
// agent server shutdown
agentServer.Stop()
// agent server restart
Expand All @@ -1536,6 +1538,7 @@ func (ts *tidbTestTopSQLSuite) TestTopSQLAgent(c *C) {
// check result
agentServer.WaitCollectCnt(2, time.Second*8)
checkFn(5)
cancel5()
}

func (ts *tidbTestTopSQLSuite) loopExec(ctx context.Context, c *C, fn func(db *sql.DB)) {
Expand Down
3 changes: 3 additions & 0 deletions structure/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const (
ListData TypeFlag = 'l'
)

// Make linter happy, since encodeHashMetaKey is unused in this repo.
var _ = (&TxStructure{}).encodeHashMetaKey

func (t *TxStructure) encodeStringDataKey(key []byte) kv.Key {
// for codec Encode, we may add extra bytes data, so here and following encode
// we will use extra length like 4 for a little optimization.
Expand Down