Skip to content

Commit d4686cd

Browse files
authored
linter: enable revive for expression (#46029)
ref #40786
1 parent 92b5a67 commit d4686cd

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

build/nogo_config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@
511511
"types/json_binary_functions.go": "types/json_binary_functions.go",
512512
"types/json_binary_test.go": "types/json_binary_test.go",
513513
"ddl/": "ddl",
514+
"expression/builtin.go": "expression/builtin code",
514515
"expression/builtin_cast.go": "expression/builtin_cast code",
515516
"server/": "server/ code",
516517
"distsql/": "distsql code",

expression/builtin.go

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (b *baseBuiltinFunc) PbCode() tipb.ScalarFuncSig {
7070
// metadata returns the metadata of a function.
7171
// metadata means some functions contain extra inner fields which will not
7272
// contain in `tipb.Expr.children` but must be pushed down to coprocessor
73-
func (b *baseBuiltinFunc) metadata() proto.Message {
73+
func (*baseBuiltinFunc) metadata() proto.Message {
7474
// We will not use a field to store them because of only
7575
// a few functions contain implicit parameters
7676
return nil
@@ -244,67 +244,67 @@ func (b *baseBuiltinFunc) getArgs() []Expression {
244244
return b.args
245245
}
246246

247-
func (b *baseBuiltinFunc) vecEvalInt(input *chunk.Chunk, result *chunk.Column) error {
247+
func (*baseBuiltinFunc) vecEvalInt(*chunk.Chunk, *chunk.Column) error {
248248
return errors.Errorf("baseBuiltinFunc.vecEvalInt() should never be called, please contact the TiDB team for help")
249249
}
250250

251-
func (b *baseBuiltinFunc) vecEvalReal(input *chunk.Chunk, result *chunk.Column) error {
251+
func (*baseBuiltinFunc) vecEvalReal(*chunk.Chunk, *chunk.Column) error {
252252
return errors.Errorf("baseBuiltinFunc.vecEvalReal() should never be called, please contact the TiDB team for help")
253253
}
254254

255-
func (b *baseBuiltinFunc) vecEvalString(input *chunk.Chunk, result *chunk.Column) error {
255+
func (*baseBuiltinFunc) vecEvalString(*chunk.Chunk, *chunk.Column) error {
256256
return errors.Errorf("baseBuiltinFunc.vecEvalString() should never be called, please contact the TiDB team for help")
257257
}
258258

259-
func (b *baseBuiltinFunc) vecEvalDecimal(input *chunk.Chunk, result *chunk.Column) error {
259+
func (*baseBuiltinFunc) vecEvalDecimal(*chunk.Chunk, *chunk.Column) error {
260260
return errors.Errorf("baseBuiltinFunc.vecEvalDecimal() should never be called, please contact the TiDB team for help")
261261
}
262262

263-
func (b *baseBuiltinFunc) vecEvalTime(input *chunk.Chunk, result *chunk.Column) error {
263+
func (*baseBuiltinFunc) vecEvalTime(*chunk.Chunk, *chunk.Column) error {
264264
return errors.Errorf("baseBuiltinFunc.vecEvalTime() should never be called, please contact the TiDB team for help")
265265
}
266266

267-
func (b *baseBuiltinFunc) vecEvalDuration(input *chunk.Chunk, result *chunk.Column) error {
267+
func (*baseBuiltinFunc) vecEvalDuration(*chunk.Chunk, *chunk.Column) error {
268268
return errors.Errorf("baseBuiltinFunc.vecEvalDuration() should never be called, please contact the TiDB team for help")
269269
}
270270

271-
func (b *baseBuiltinFunc) vecEvalJSON(input *chunk.Chunk, result *chunk.Column) error {
271+
func (*baseBuiltinFunc) vecEvalJSON(*chunk.Chunk, *chunk.Column) error {
272272
return errors.Errorf("baseBuiltinFunc.vecEvalJSON() should never be called, please contact the TiDB team for help")
273273
}
274274

275-
func (b *baseBuiltinFunc) evalInt(row chunk.Row) (int64, bool, error) {
275+
func (*baseBuiltinFunc) evalInt(chunk.Row) (int64, bool, error) {
276276
return 0, false, errors.Errorf("baseBuiltinFunc.evalInt() should never be called, please contact the TiDB team for help")
277277
}
278278

279-
func (b *baseBuiltinFunc) evalReal(row chunk.Row) (float64, bool, error) {
279+
func (*baseBuiltinFunc) evalReal(chunk.Row) (float64, bool, error) {
280280
return 0, false, errors.Errorf("baseBuiltinFunc.evalReal() should never be called, please contact the TiDB team for help")
281281
}
282282

283-
func (b *baseBuiltinFunc) evalString(row chunk.Row) (string, bool, error) {
283+
func (*baseBuiltinFunc) evalString(chunk.Row) (string, bool, error) {
284284
return "", false, errors.Errorf("baseBuiltinFunc.evalString() should never be called, please contact the TiDB team for help")
285285
}
286286

287-
func (b *baseBuiltinFunc) evalDecimal(row chunk.Row) (*types.MyDecimal, bool, error) {
287+
func (*baseBuiltinFunc) evalDecimal(chunk.Row) (*types.MyDecimal, bool, error) {
288288
return nil, false, errors.Errorf("baseBuiltinFunc.evalDecimal() should never be called, please contact the TiDB team for help")
289289
}
290290

291-
func (b *baseBuiltinFunc) evalTime(row chunk.Row) (types.Time, bool, error) {
291+
func (*baseBuiltinFunc) evalTime(chunk.Row) (types.Time, bool, error) {
292292
return types.ZeroTime, false, errors.Errorf("baseBuiltinFunc.evalTime() should never be called, please contact the TiDB team for help")
293293
}
294294

295-
func (b *baseBuiltinFunc) evalDuration(row chunk.Row) (types.Duration, bool, error) {
295+
func (*baseBuiltinFunc) evalDuration(chunk.Row) (types.Duration, bool, error) {
296296
return types.Duration{}, false, errors.Errorf("baseBuiltinFunc.evalDuration() should never be called, please contact the TiDB team for help")
297297
}
298298

299-
func (b *baseBuiltinFunc) evalJSON(row chunk.Row) (types.BinaryJSON, bool, error) {
299+
func (*baseBuiltinFunc) evalJSON(chunk.Row) (types.BinaryJSON, bool, error) {
300300
return types.BinaryJSON{}, false, errors.Errorf("baseBuiltinFunc.evalJSON() should never be called, please contact the TiDB team for help")
301301
}
302302

303-
func (b *baseBuiltinFunc) vectorized() bool {
303+
func (*baseBuiltinFunc) vectorized() bool {
304304
return false
305305
}
306306

307-
func (b *baseBuiltinFunc) supportReverseEval() bool {
307+
func (*baseBuiltinFunc) supportReverseEval() bool {
308308
return false
309309
}
310310

@@ -321,7 +321,7 @@ func (b *baseBuiltinFunc) isChildrenReversed() bool {
321321
return b.childrenReversed
322322
}
323323

324-
func (b *baseBuiltinFunc) reverseEval(sc *stmtctx.StatementContext, res types.Datum, rType types.RoundingType) (types.Datum, error) {
324+
func (*baseBuiltinFunc) reverseEval(*stmtctx.StatementContext, types.Datum, types.RoundingType) (types.Datum, error) {
325325
return types.Datum{}, errors.Errorf("baseBuiltinFunc.reverseEvalInt() should never be called, please contact the TiDB team for help")
326326
}
327327

@@ -339,8 +339,7 @@ func (b *baseBuiltinFunc) isChildrenVectorized() bool {
339339
}
340340

341341
func (b *baseBuiltinFunc) getRetTp() *types.FieldType {
342-
switch b.tp.EvalType() {
343-
case types.ETString:
342+
if b.tp.EvalType() == types.ETString {
344343
if b.tp.GetFlen() >= mysql.MaxBlobWidth {
345344
b.tp.SetType(mysql.TypeLongBlob)
346345
} else if b.tp.GetFlen() >= 65536 {
@@ -386,7 +385,7 @@ func (b *baseBuiltinFunc) cloneFrom(from *baseBuiltinFunc) {
386385
b.ctor = from.ctor
387386
}
388387

389-
func (b *baseBuiltinFunc) Clone() builtinFunc {
388+
func (*baseBuiltinFunc) Clone() builtinFunc {
390389
panic("you should not call this method.")
391390
}
392391

0 commit comments

Comments
 (0)