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

staticcheck report some errors #13456

Closed
zhouqiang-cl opened this issue Nov 14, 2019 · 12 comments · Fixed by #14420
Closed

staticcheck report some errors #13456

zhouqiang-cl opened this issue Nov 14, 2019 · 12 comments · Fixed by #14420
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/enhancement The issue or PR belongs to an enhancement.

Comments

@zhouqiang-cl
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    run
GO111MODULE=on staticcheck ./...
  1. What did you expect to see?
    No output

  2. What did you see instead?

cmd/ddltest/random.go:21:6: func randomInt is unused (U1000)
cmd/ddltest/random.go:25:6: func randomIntn is unused (U1000)
cmd/ddltest/random.go:29:6: func randomFloat is unused (U1000)
cmd/ddltest/random.go:33:6: func randomString is unused (U1000)
cmd/ddltest/random.go:48:6: func randomNum is unused (U1000)
cmd/ddltest/random.go:66:6: func randomFloat64 is unused (U1000)
cmd/ddltest/random.go:78:6: func randomBool is unused (U1000)
config/config.go:154:9: assigning the result of this type assertion to a variable (switch v := v.(type)) could eliminate the following type assertions:
	/Users/zhouqiang/go/src/github.com/pingcap/tidb/config/config.go:156:27 (S1034)
config/config.go:635:5: no value of type uint is less than 0 (SA4003)
kv/memdb_buffer.go:31:2: field bufferLenLimit is unused (U1000)
owner/fail_test.go:92:38: grpc.ErrClientConnClosing is deprecated: this error should not be relied upon by users; use the status code of Canceled instead.  (SA1019)
owner/fail_test.go:110:38: grpc.ErrClientConnClosing is deprecated: this error should not be relied upon by users; use the status code of Canceled instead.  (SA1019)
owner/manager.go:379:26: grpc.ErrClientConnClosing is deprecated: this error should not be relied upon by users; use the status code of Canceled instead.  (SA1019)
store/tikv/oracle/oracles/export_test.go:36:6: func ClearOracleHook is unused (U1000)
types/convert_test.go:958:33: should use make(map[string]interface{}) instead (S1019)
types/datum.go:1662:17: func (*Datum).convergeType is unused (U1000)
types/export_test.go:17:5: var CheckTimestampTypeForTest is unused (U1000)
types/json/binary.go:360:22: func BinaryJSON.marshalValueEntryTo is unused (U1000)
types/time.go:2255:5: var weekdayAbbrev is unused (U1000)
types/time.go:2495:5: var twoDigitRegex is unused (U1000)
types/time.go:2505:6: func parseTwoNumeric is unused (U1000)
types/time.go:2619:6: func abbreviatedWeekday is unused (U1000)
types/time.go:2665:6: func dayOfMonthWithSuffix is unused (U1000)
types/time.go:2674:6: func parseOrdinalNumbers is unused (U1000)
util/chunk/codec.go:296:62: invalid operation: shift count bitOffset (variable of type int) must be unsigned integer (compile)
util/encrypt/aes.go:55:2: redundant return statement (S1023)
util/encrypt/crypt.go:91:21: func (*sqlCrypt).reinit is unused (U1000)
util/kvcache/simple_lru.go:51:5: no value of type uint is less than 0 (SA4003)
util/kvcache/simple_lru.go:93:5: no value of type uint64 is less than 0 (SA4003)
util/mvmap/fnv.go:21:2: only the first constant in this group has an explicit type (SA9004)
util/plancodec/codec.go:223:7: identical expressions on the left and right side of the '!=' operator (SA4000)
util/profile/profile.go:113:19: this result of append is never used, except maybe in other appends (SA4010)
util/stringutil/string_util.go:191:7: const caseDiff is unused (U1000)
util/stringutil/string_util_test.go:65:4: string literal contains the Unicode control character U+0005, consider using the '\x05' escape sequence (ST1018)
util/stringutil/string_util_test.go:65:4: string literal contains the Unicode control character U+0018, consider using the '\x18' escape sequence (ST1018)
util/stringutil/string_util_test.go:65:22: string literal contains the Unicode control character U+0005, consider using the '\x05' escape sequence (ST1018)
util/stringutil/string_util_test.go:65:22: string literal contains the Unicode control character U+0018, consider using the '\x18' escape sequence (ST1018)
util/testutil/testutil.go:153:34: should use make([]testCases, len(res.input)) instead (S1019)
util/testutil/testutil.go:276:23: should use make([]byte, len(buf.Bytes())) instead (S1019)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    master
@zhouqiang-cl zhouqiang-cl added the type/bug The issue is confirmed as a bug. label Nov 14, 2019
@siddontang
Copy link
Member

@zhouqiang-cl maybe we can add this to CI later

@zhouqiang-cl
Copy link
Contributor Author

@siddontang yes. when this issue is fixed

@siddontang siddontang added difficulty/easy help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Nov 14, 2019
@ngaut ngaut added type/enhancement The issue or PR belongs to an enhancement. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. and removed type/bug The issue is confirmed as a bug. labels Nov 15, 2019
@hsqlu
Copy link
Contributor

hsqlu commented Nov 19, 2019

Can this be fixed in one pr or separately?

@zhouqiang-cl
Copy link
Contributor Author

@zz-jason PTAL

@someblue
Copy link
Contributor

Here is more static check error using latest version ([email protected])

bindinfo/bind_test.go:56:2: field ctx is unused (U1000)
bindinfo/handle.go:478:2: unnecessary nil check around range (S1031)
bindinfo/handle.go:520:20: the argument is already a string, there's no need to use fmt.Sprintf (S1025)
bindinfo/session_handle.go:91:2: unnecessary nil check around range (S1031)
cmd/benchdb/main.go:51:2: var sslCA is unused (U1000)
cmd/benchdb/main.go:52:2: var sslCert is unused (U1000)
cmd/benchdb/main.go:53:2: var sslKey is unused (U1000)
cmd/benchkv/main.go:43:2: var sslCA is unused (U1000)
cmd/benchkv/main.go:44:2: var sslCert is unused (U1000)
cmd/benchkv/main.go:45:2: var sslKey is unused (U1000)
cmd/ddltest/ddl_test.go:82:2: field storePath is unused (U1000)
cmd/ddltest/ddl_test.go:259:2: should merge variable declaration with assignment on next line (S1021)
cmd/ddltest/ddl_test.go:424:24: func (*TestDDLSuite).mustQuery is unused (U1000)
cmd/explaintest/main.go:143:71: cutset contains duplicate characters (SA1024)
cmd/explaintest/main.go:145:71: cutset contains duplicate characters (SA1024)
cmd/explaintest/main.go:147:48: cutset contains duplicate characters (SA1024)
cmd/explaintest/main.go:581:6: func resultExists is unused (U1000)
cmd/importer/data.go:75:5: no value of type uint64 is less than 0 (SA4003)
cmd/importer/data.go:87:17: func (*datum).nextFloat64 is unused (U1000)
cmd/importer/data.go:125:5: no value of type uint64 is less than 0 (SA4003)
cmd/importer/data.go:140:5: no value of type uint64 is less than 0 (SA4003)
cmd/importer/data.go:155:5: no value of type uint64 is less than 0 (SA4003)
cmd/importer/data.go:172:5: no value of type uint64 is less than 0 (SA4003)
cmd/importer/stats.go:69:21: func (*histogram).decodeInt is unused (U1000)
cmd/importer/stats.go:91:21: func (*histogram).randFloat64 is unused (U1000)
cmd/importer/stats.go:102:21: func (*histogram).randFloat32 is unused (U1000)
cmd/importer/stats.go:113:21: func (*histogram).randDecimal is unused (U1000)
config/config.go:156:9: assigning the result of this type assertion to a variable (switch v := v.(type)) could eliminate the following type assertions:
	/Users/someblue/workspace/run/golang/src/github.com/someblue/tidb/config/config.go:158:27 (S1034)
config/config.go:638:5: no value of type uint is less than 0 (SA4003)
ddl/callback_test.go:93:15: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012)
ddl/column_test.go:633:103: argument handle is overwritten before first use (SA4009)
ddl/db_integration_test.go:665:2: this value of rs is never used (SA4006)
ddl/db_integration_test.go:668:2: this value of rs is never used (SA4006)
ddl/db_integration_test.go:672:2: this value of rs is never used (SA4006)
ddl/db_integration_test.go:676:2: this value of rs is never used (SA4006)
ddl/db_integration_test.go:680:2: this value of rs is never used (SA4006)
ddl/db_integration_test.go:684:2: this value of rs is never used (SA4006)
ddl/db_integration_test.go:688:2: this value of rs is never used (SA4006)
ddl/db_test.go:841:24: func (*testDBSuite4).testAlterLock is unused (U1000)
ddl/db_test.go:1778:2: should use for range instead of for { select {} } (S1000)
ddl/db_test.go:2729:2: this value of rs is never used (SA4006)
ddl/db_test.go:2731:2: this value of rs is never used (SA4006)
ddl/db_test.go:3768:13: sleeping for 50 nanoseconds is probably a bug. Be explicit if it isn't: time.Sleep(50 * time.Nanosecond) (SA1004)
ddl/ddl.go:84:2: var errInvalidDDLJobFlag is unused (U1000)
ddl/ddl.go:459:38: the argument is already a string, there's no need to use fmt.Sprintf (S1025)
ddl/ddl_algorithm.go:44:2: var defaultAlgorithm is unused (U1000)
ddl/ddl_api.go:466:37: should use !strings.EqualFold(a, b) instead of strings.ToUpper(a) != strings.ToUpper(b) (SA6005)
ddl/ddl_api.go:2755:6: should omit comparison to bool constant, can be simplified to !containColumn (S1002)
ddl/ddl_api.go:3919:38: should use make([]string, 0) instead (S1019)
ddl/ddl_worker.go:457:23: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012)
ddl/ddl_worker.go:680:3: should use a simple channel send/receive instead of select with a single case (S1000)
ddl/reorg.go:360:13: no value of type uint64 is less than 0 (SA4003)
ddl/stat.go:26:2: var ddlOwnerID is unused (U1000)
ddl/stat.go:27:2: var ddlOwnerLastUpdateTS is unused (U1000)
ddl/util/syncer.go:66:2: var ddlLogCtx is unused (U1000)
ddl/util/syncer_test.go:105:2: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
ddl/util/syncer_test.go:228:55: grpc.Code is deprecated: use status.Code instead.  (SA1019)
ddl/util/syncer_test.go:248:5: identical expressions on the left and right side of the '!=' operator (SA4000)
distsql/distsql.go:32:2: const codeInvalidResp is unused (U1000)
distsql/distsql_test.go:492:3: should use for {} instead of for true {} (S1006)
distsql/distsql_test.go:517:3: should use for {} instead of for true {} (S1006)
domain/db_test.go:30:5: var suite is unused (U1000)
domain/global_vars_cache.go:67:2: redundant return statement (S1023)
domain/topn_slow_query.go:177:6: type queryType is unused (U1000)
domain/topn_slow_query.go:180:2: const queryTypeTop is unused (U1000)
domain/topn_slow_query.go:181:2: const queryTypeRecent is unused (U1000)
...... (total 255 errors)

@Deardrops
Copy link
Contributor

Deardrops commented Dec 27, 2019

https://github.com/pingcap/parser also need to do the staticcheck,
If you interested in it, feel free to contribution to parser repo.

@zhouqiang-cl
Copy link
Contributor Author

@mahjonp PTAL. and add this to CI. I think it can work on CI now

@mahjonp
Copy link
Contributor

mahjonp commented Jan 9, 2020

staticcheck on 0a0e388

ddl/column_test.go:633:103: argument handle is overwritten before first use (SA4009)
ddl/db_test.go:1792:2: should use for range instead of for { select {} } (S1000)
ddl/db_test.go:2231:25: should use make([]string, 0) instead (S1019)
ddl/ddl.go:103:2: var errUnknownTypeLength is unused (U1000)
ddl/ddl.go:104:2: var errUnknownFractionLength is unused (U1000)
ddl/ddl_worker.go:457:23: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012)
ddl/ddl_worker.go:682:3: should use a simple channel send/receive instead of select with a single case (S1000)
ddl/reorg.go:390:12: no value of type uint64 is less than 0 (SA4003)
ddl/util/syncer_test.go:110:2: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
distsql/distsql.go:195:5: don't use Yoda conditions (ST1017)
domain/domain.go:631:6: grpc.WithBackoffMaxDelay is deprecated: use WithConnectParams instead. Will be supported throughout 1.x.  (SA1019)
executor/aggfuncs/func_first_row.go:483:3: the surrounding loop is unconditionally terminated (SA4004)
executor/aggfuncs/func_first_row.go:529:3: the surrounding loop is unconditionally terminated (SA4004)
executor/analyze.go:248:2: field priority is unused (U1000)
executor/analyze.go:400:2: field priority is unused (U1000)
executor/benchmark_test.go:1120:29: this result of append is never used, except maybe in other appends (SA4010)
executor/benchmark_test.go:1158:6: func defaultMergeJoinTestCase is unused (U1000)
executor/builder.go:2300:23: this result of append is never used, except maybe in other appends (SA4010)
executor/builder.go:2306:23: this result of append is never used, except maybe in other appends (SA4010)
executor/executor_test.go:4468:5: this value of err is never used (SA4006)
executor/hash_table.go:165:2: should merge variable declaration with assignment on next line (S1021)
executor/hash_table.go:193:26: func (*hashRowContainer).getJoinKeyFromChkRow is unused (U1000)
executor/index_merge_reader.go:87:2: field kvRanges is unused (U1000)
executor/index_merge_reader.go:94:2: field memTracker is unused (U1000)
executor/index_merge_reader.go:97:2: field checkIndexValue is unused (U1000)
executor/index_merge_reader.go:99:2: field corColInIdxSide is unused (U1000)
executor/index_merge_reader.go:101:2: field corColInTblSide is unused (U1000)
executor/index_merge_reader.go:103:2: field corColInAccess is unused (U1000)
executor/index_merge_reader.go:104:2: field idxCols is unused (U1000)
executor/index_merge_reader.go:105:2: field colLens is unused (U1000)
executor/index_merge_reader.go:486:3: should use a simple channel send/receive instead of select with a single case (S1000)
executor/index_merge_reader.go:547:2: should merge variable declaration with assignment on next line (S1021)
executor/insert_common.go:260:2: this value of rows is never used (SA4006)
executor/merge_join_test.go:270:2: redundant return statement (S1023)
executor/projection.go:324:2: field wg is unused (U1000)
executor/seqtest/seq_executor_test.go:80:2: field ctx is unused (U1000)
executor/sort.go:43:2: field keyExprs is unused (U1000)
executor/sort.go:44:2: field keyTypes is unused (U1000)
executor/sort.go:317:20: func (*SortExec).alreadySpilledSafe is unused (U1000)
executor/trace.go:51:2: field rootTrace is unused (U1000)
executor/update_test.go:37:2: field ctx is unused (U1000)
expression/bench_test.go:1259:7: should merge variable declaration with assignment on next line (S1021)
expression/builtin_arithmetic.go:405:16: no value of type int64 is greater than math.MaxInt64 (SA4003)
expression/builtin_arithmetic.go:410:16: no value of type int64 is greater than math.MaxInt64 (SA4003)
expression/builtin_arithmetic_vec.go:375:17: no value of type int64 is greater than math.MaxInt64 (SA4003)
expression/builtin_arithmetic_vec.go:379:17: no value of type int64 is greater than math.MaxInt64 (SA4003)
expression/builtin_arithmetic_vec.go:399:17: no value of type int64 is greater than math.MaxInt64 (SA4003)
expression/builtin_arithmetic_vec.go:419:17: no value of type int64 is greater than math.MaxInt64 (SA4003)
expression/builtin_compare.go:2078:18: no value of type int64 is greater than math.MaxInt64 (SA4003)
expression/builtin_compare.go:2085:18: no value of type int64 is greater than math.MaxInt64 (SA4003)
expression/builtin_encryption_vec.go:540:15: argument should be pointer-like to avoid allocations (SA6002)
expression/builtin_like.go:119:23: from.memorizedRegexp.Copy is deprecated: In earlier releases, when using a Regexp in multiple goroutines, giving each goroutine its own copy helped to avoid lock contention. As of Go 1.12, using Copy is no longer necessary to avoid lock contention. Copy may still be appropriate if the reason for its use is to make two copies with different Longest settings.  (SA1019)
expression/builtin_vectorized_test.go:782:2: this value of sel is never used (SA4006)
expression/chunk_executor.go:110:10: empty branch (SA9003)
expression/chunk_executor.go:110:34: HasUnsignedFlag is a pure function but its return value is ignored (SA4017)
expression/constant_propagation_test.go:37:21: func (*testSuite).cleanEnv is unused (U1000)
expression/evaluator_test.go:54:2: field ctx is unused (U1000)
expression/expression.go:266:14: argument should be pointer-like to avoid allocations (SA6002)
expression/expression.go:279:15: argument should be pointer-like to avoid allocations (SA6002)
expression/integration_test.go:4290:32: func (*testIntegrationSuite).testTiDBIsOwnerFunc is unused (U1000)
expression/partition_pruner.go:166:36: should use make([]*Constant, p.numColumn) instead (S1019)
expression/partition_pruner_test.go:37:22: func (*testSuite2).cleanEnv is unused (U1000)
expression/simple_rewriter.go:258:27: func (*simpleRewriter).useCache is unused (U1000)
expression/util_test.go:39:25: func (*testUtilSuite).checkPanic is unused (U1000)
infoschema/metric_schema.go:90:2: should replace this if statement with an unconditional strings.Replace (S1017)
infoschema/metric_schema.go:94:2: should replace this if statement with an unconditional strings.Replace (S1017)
infoschema/metric_schema.go:98:2: should replace this if statement with an unconditional strings.Replace (S1017)
kv/memdb_buffer.go:31:2: field bufferLenLimit is unused (U1000)
kv/mock_test.go:83:36: do not pass a nil Context, even if a function permits it; pass context.TODO if you are unsure about which Context to use (SA1012)
owner/fail_test.go:92:38: grpc.ErrClientConnClosing is deprecated: this error should not be relied upon by users; use the status code of Canceled instead.  (SA1019)
owner/fail_test.go:110:38: grpc.ErrClientConnClosing is deprecated: this error should not be relied upon by users; use the status code of Canceled instead.  (SA1019)
owner/manager.go:379:26: grpc.ErrClientConnClosing is deprecated: this error should not be relied upon by users; use the status code of Canceled instead.  (SA1019)
planner/cascades/implementation_rules.go:94:2: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008)
planner/cascades/transformation_rules.go:1219:2: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008)
planner/core/common_plans.go:768:3: this value of err is never used (SA4006)
planner/core/encode.go:111:15: should use d.buf.String() instead of string(d.buf.Bytes()) (S1030)
planner/core/exhaust_physical_plans.go:627:2: field chosenIndexInfo is unused (U1000)
planner/core/exhaust_physical_plans.go:1161:2: unnecessary nil check around range (S1031)
planner/core/exhaust_physical_plans.go:1177:33: should use make([]types.Datum, pointLength + 1) instead (S1019)
planner/core/exhaust_physical_plans.go:1178:33: should use make([]types.Datum, pointLength + 1) instead (S1019)
planner/core/exhaust_physical_plans.go:1182:33: should use make([]types.Datum, pointLength) instead (S1019)
planner/core/exhaust_physical_plans.go:1183:33: should use make([]types.Datum, pointLength) instead (S1019)
planner/core/find_best_task.go:252:5: should omit comparison to bool constant, can be simplified to !l (S1002)
planner/core/logical_plans.go:238:2: field calculateGenCols is unused (U1000)
planner/core/physical_plans.go:349:2: field outerSchema is unused (U1000)
planner/core/planbuilder.go:275:29: func (*handleColHelper).appendColToLastMap is unused (U1000)
planner/core/point_get_plan.go:51:2: field expr is unused (U1000)
planner/core/point_get_plan.go:52:2: field ctx is unused (U1000)
planner/core/rule_join_reorder_dp.go:285:31: func (*joinReorderDPSolver).newJoinWithConds is unused (U1000)
planner/core/rule_partition_processor.go:156:21: should omit comparison to bool constant, can be simplified to !ret (S1002)
planner/core/rule_partition_processor.go:230:22: should omit comparison to bool constant, can be simplified to !ret (S1002)
planner/core/rule_partition_processor.go:309:21: should omit comparison to bool constant, can be simplified to !ret (S1002)
planner/core/stats.go:556:18: don't use Yoda conditions (ST1017)
planner/core/task.go:973:2: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008)
planner/memo/group_test.go:134:2: field cost is unused (U1000)
plugin/conn_ip_example/conn_ip_example.go:25:6: func Validate is unused (U1000)
plugin/conn_ip_example/conn_ip_example.go:31:6: func OnInit is unused (U1000)
plugin/conn_ip_example/conn_ip_example.go:38:6: func OnShutdown is unused (U1000)
plugin/conn_ip_example/conn_ip_example.go:44:6: func OnGeneralEvent is unused (U1000)
plugin/conn_ip_example/conn_ip_example_test.go:25:6: func LoadRunShutdownPluginExample is unused (U1000)
server/conn_test.go:348:26: func (*ConnTestSuite).testGetSessionVarsWaitTimeout is unused (U1000)
server/http_handler.go:583:2: field first is unused (U1000)
server/http_handler.go:584:2: field last is unused (U1000)
server/http_handler.go:585:2: field region is unused (U1000)
server/http_handler.go:1221:6: type hotRegion is unused (U1000)
server/http_handler.go:1225:6: type hotRegions is unused (U1000)
server/server.go:641:2: const codeUnknownFieldType is unused (U1000)
server/server.go:642:2: const codeInvalidSequence is unused (U1000)
server/server.go:643:2: const codeInvalidType is unused (U1000)
server/server_test.go:119:20: func (*DBTest).fail is unused (U1000)
server/statistics_handler_test.go:72:31: func (*testDumpStatsSuite).stopServer is unused (U1000)
server/statistics_handler_test.go:238:31: func (*testDumpStatsSuite).clearData is unused (U1000)
session/session.go:1503:2: empty branch (SA9003)
session/session_test.go:114:4: grpc.WithBackoffMaxDelay is deprecated: use WithConnectParams instead. Will be supported throughout 1.x.  (SA1019)
session/session_test.go:482:2: this value of txn is never used (SA4006)
sessionctx/binloginfo/binloginfo.go:158:2: should use for range instead of for { select {} } (S1000)
sessionctx/binloginfo/binloginfo_test.go:101:9: grpc.WithDialer is deprecated: use WithContextDialer instead.  Will be supported throughout 1.x.  (SA1019)
sessionctx/variable/statusvar.go:106:2: tls.VersionSSL30 is deprecated: SSLv3 is cryptographically broken, and will be removed in Go 1.14. See golang.org/issue/32716.  (SA1019)
store/mockstore/mocktikv/cluster.go:645:2: field tokenCount is unused (U1000)
store/mockstore/mocktikv/cluster_test.go:38:2: field store is unused (U1000)
store/mockstore/mocktikv/mvcc.go:243:6: type rawEntry is unused (U1000)
store/tikv/2pc_test.go:675:13: should use time.Since instead of time.Now().Sub (S1012)
store/tikv/2pc_test.go:685:12: should use time.Since instead of time.Now().Sub (S1012)
store/tikv/coprocessor_cache.go:155:5: should use !bytes.Equal(typedValue.Key, key) instead (S1004)
store/tikv/oracle/oracles/export_test.go:36:6: func ClearOracleHook is unused (U1000)
store/tikv/region_cache.go:430:23: func (*RegionCache).loadAndInsertRegion is unused (U1000)
store/tikv/store_test.go:111:24: func (*mockPDClient).enable is unused (U1000)
store/tikv/txn.go:64:2: field assertions is unused (U1000)
store/tikv/txn.go:65:2: field confirmed is unused (U1000)
store/tikv/txn.go:96:6: type assertionPair is unused (U1000)
tidb-server/main.go:576:63: no value of type uint64 is less than 0 (SA4003)
util/chunk/row_container.go:37:2: field numRow is unused (U1000)
util/rowcodec/rowcodec_test.go:596:16: this result of append is never used, except maybe in other appends (SA4010)
util/stmtsummary/statement_summary.go:610:44: should use make(map[fmt.Stringer]int) instead (S1019)

@zhouqiang-cl
Copy link
Contributor Author

@zz-jason PTAL

@zhouqiang-cl
Copy link
Contributor Author

we will add it in CI. But first this issue need to fix

@mahjonp
Copy link
Contributor

mahjonp commented Jan 9, 2020

@zhouqiang-cl @zz-jason there are quite some static check rules, we'd better pick some of them running on CI jobs: https://staticcheck.io/docs/checks#checks

@zhouqiang-cl
Copy link
Contributor Author

@mahjonp I think we can

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants