pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.6k stars 5.76k forks source link

`deadcode` reports a lot of dead code in TiDB #50727

Open YangKeao opened 5 months ago

YangKeao commented 5 months ago

Enhancement

I ran the deadcode tool in tidb:

rm tools/check/*
deadcode -test -tags intest ./...

It'll give you:

❯ deadcode -test -tags intest ./...
br/pkg/glue/console_glue.go:48:6: unreachable func: WithCallbackExtraField
br/pkg/lightning/lightning.go:624:21: unreachable func: Lightning.Metrics
br/pkg/lightning/run_options.go:44:6: unreachable func: WithDumpFileStorage
br/pkg/lightning/run_options.go:52:6: unreachable func: WithCheckpointStorage
br/pkg/lightning/run_options.go:60:6: unreachable func: WithPromFactory
br/pkg/lightning/run_options.go:69:6: unreachable func: WithPromRegistry
br/pkg/lightning/run_options.go:76:6: unreachable func: WithLogger
br/pkg/lightning/run_options.go:83:6: unreachable func: WithDupIndicator
br/pkg/lightning/backend/local/local_test.go:557:6: unreachable func: makeRanges
br/pkg/lightning/backend/tidb/tidb_test.go:279:6: unreachable func: testStrictMode
br/pkg/lightning/importer/import.go:1423:23: unreachable func: Controller.buildTablesRanges
br/pkg/lightning/importer/precheck.go:35:6: unreachable func: NewPrecheckItemBuilderFromConfig
br/pkg/lightning/importer/opts/precheck_opts.go:32:6: unreachable func: WithPreInfoGetterOptions
br/pkg/lightning/importer/opts/precheck_opts.go:40:6: unreachable func: WithMDLoaderSetupOptions
br/pkg/lightning/mydump/loader.go:170:6: unreachable func: ReturnPartialResultOnError
br/pkg/lightning/mydump/loader.go:177:6: unreachable func: WithFileIterator
br/pkg/logutil/logging.go:64:6: unreachable func: AbbreviatedStringers
br/pkg/logutil/logging.go:146:6: unreachable func: RewriteRuleObject
br/pkg/logutil/logging.go:333:6: unreachable func: StringifyMany
br/pkg/logutil/logging.go:351:19: unreachable func: HexBytes.String
br/pkg/logutil/logging.go:356:19: unreachable func: HexBytes.MarshalJSON
br/pkg/mock/mockid/mockid.go:35:21: unreachable func: IDAllocator.Rebase
br/pkg/pdutil/utils.go:68:6: unreachable func: SearchPlacementRule
br/pkg/restore/util.go:126:6: unreachable func: GetRewriteRulesMap
br/pkg/restore/split/client.go:554:20: unreachable func: pdClient.getPDAPIAddr
br/pkg/restore/stream_metas_test.go:346:6: unreachable func: fakeMetaDatas
br/pkg/restore/stream_metas_test.go:400:6: unreachable func: fakeMetaDataV2s
br/pkg/storage/writer.go:239:6: unreachable func: NewUploaderWriter
br/pkg/streamhelper/regioniter.go:67:22: unreachable func: RegionIter.String
br/pkg/task/stream.go:1544:6: unreachable func: countIndices
br/pkg/task/stream_test.go:118:6: unreachable func: fakeMetaFiles
br/pkg/task/operator/cmd.go:185:6: unreachable func: getCallerName
br/pkg/utils/db.go:58:6: unreachable func: CheckLogBackupEnabled
br/pkg/utils/store_manager.go:44:16: unreachable func: Pool.takeConns
br/pkg/utils/store_manager.go:53:16: unreachable func: Pool.Close
br/pkg/utils/store_manager.go:62:16: unreachable func: Pool.Get
br/pkg/utils/store_manager.go:80:6: unreachable func: NewConnPool
build/linter/allrevive/analyzer.go:39:6: unreachable func: init#1
build/linter/allrevive/analyzer.go:124:6: unreachable func: run
build/linter/asciicheck/analysis.go:25:6: unreachable func: init#1
build/linter/bodyclose/analysis.go:25:6: unreachable func: init#1
build/linter/bootstrap/analyzer.go:39:6: unreachable func: run
build/linter/bootstrap/analyzer.go:165:6: unreachable func: init#1
build/linter/constructor/analyzer.go:49:6: unreachable func: getConstructorList
build/linter/constructor/analyzer.go:91:6: unreachable func: assertInConstructor
build/linter/constructor/analyzer.go:109:6: unreachable func: handleCompositeLit
build/linter/constructor/analyzer.go:127:6: unreachable func: handleCallExpr
build/linter/constructor/analyzer.go:145:6: unreachable func: handleValueSpec
build/linter/constructor/analyzer.go:159:6: unreachable func: run
build/linter/constructor/analyzer.go:179:6: unreachable func: init#1
build/linter/deferrecover/analyzer.go:40:6: unreachable func: run
build/linter/deferrecover/analyzer.go:82:6: unreachable func: init#1
build/linter/durationcheck/analyzer.go:25:6: unreachable func: init#1
build/linter/errcheck/analyzer.go:31:6: unreachable func: init#1
build/linter/etcdconfig/analyzer.go:39:6: unreachable func: run
build/linter/etcdconfig/analyzer.go:91:6: unreachable func: init#1
build/linter/exportloopref/analyzer.go:25:6: unreachable func: init#1
build/linter/filepermission/checker.go:34:6: unreachable func: run
build/linter/filepermission/checker.go:51:6: unreachable func: init#1
build/linter/forcetypeassert/analysis.go:25:6: unreachable func: init#1
build/linter/gci/analysis.go:34:6: unreachable func: run
build/linter/gci/analysis.go:70:6: unreachable func: init#1
build/linter/gofmt/analyzer.go:36:6: unreachable func: init#1
build/linter/gofmt/analyzer.go:40:6: unreachable func: run
build/linter/gofmt/analyzer.go:68:6: unreachable func: init#2
build/linter/gosec/analysis.go:43:6: unreachable func: init#1
build/linter/gosec/analysis.go:48:6: unreachable func: run
build/linter/gosec/analysis.go:103:6: unreachable func: filterIssues
build/linter/ineffassign/analyzer.go:25:6: unreachable func: init#1
build/linter/lll/analyzer.go:63:6: unreachable func: runLll
build/linter/lll/analyzer.go:92:6: unreachable func: getLLLIssuesForFile
build/linter/lll/analyzer.go:163:6: unreachable func: init#1
build/linter/makezero/analyzer.go:25:6: unreachable func: init#1
build/linter/mirror/analyzer.go:25:6: unreachable func: init#1
build/linter/misspell/analyzer.go:36:6: unreachable func: init#1
build/linter/misspell/analyzer.go:47:6: unreachable func: run
build/linter/misspell/analyzer.go:77:6: unreachable func: runOnFile
build/linter/noloopclosure/analysis.go:25:6: unreachable func: init#1
build/linter/prealloc/analyzer.go:42:6: unreachable func: run
build/linter/prealloc/analyzer.go:58:6: unreachable func: init#1
build/linter/predeclared/analysis.go:25:6: unreachable func: init#1
build/linter/revive/analyzer.go:39:6: unreachable func: init#1
build/linter/revive/analyzer.go:93:6: unreachable func: run
build/linter/rowserrcheck/analyzer.go:25:6: unreachable func: init#1
build/linter/staticcheck/analyzer.go:30:6: unreachable func: init#1
build/linter/staticcheck/util.go:49:6: unreachable func: FindAnalyzerByName
build/linter/toomanytests/analyze.go:55:6: unreachable func: isTestFile
build/linter/toomanytests/analyze.go:59:6: unreachable func: init#1
build/linter/unconvert/analysis.go:39:6: unreachable func: init#1
build/linter/unconvert/analysis.go:45:6: unreachable func: run
build/linter/unconvert/analysis.go:99:6: unreachable func: isUntypedValue
build/linter/unconvert/analysis.go:152:6: unreachable func: asBuiltin
build/linter/util/util.go:104:6: unreachable func: SkipAnalyzer
build/linter/util/util.go:166:6: unreachable func: SkipAnalyzerByConfig
build/linter/util/util.go:186:6: unreachable func: FormatCode
build/linter/util/util.go:195:6: unreachable func: MakeFakeLoaderPackageInfo
build/linter/util/util.go:215:6: unreachable func: ReadFile
build/linter/util/util.go:227:6: unreachable func: FindOffset
build/linter/util/util.go:250:6: unreachable func: GetPackageName
cmd/mirror/skylarkutil.go:174:6: unreachable func: ExpectSingletonStringList
dumpling/context/context.go:29:6: unreachable func: NewContext
dumpling/export/sql.go:53:6: unreachable func: ShowTables
dumpling/export/sql.go:383:6: unreachable func: SelectVersion
dumpling/export/sql.go:623:6: unreachable func: LockTables
dumpling/export/writer_util.go:533:28: unreachable func: LazyStringWriter.WriteString
dumpling/export/writer_util.go:631:21: unreachable func: FileFormat.String
pkg/ddl/column.go:1871:6: unreachable func: GetColumnForeignKeyInfo
pkg/ddl/ddl.go:1906:6: unreachable func: PauseAllJobsBySystem
pkg/ddl/tests/tiflash/ddl_tiflash_test.go:496:6: unreachable func: CheckTableNoReplica
pkg/distsql/request_builder.go:90:32: unreachable func: RequestBuilder.SetTableRanges
pkg/distsql/request_builder.go:205:32: unreachable func: RequestBuilder.SetKeyRangesWithHints
pkg/disttask/importinto/job.go:102:22: unreachable func: DistImporter.Import
pkg/disttask/importinto/job.go:214:22: unreachable func: DistImporter.taskKey
pkg/disttask/importinto/scheduler.go:441:6: unreachable func: dropTableIndexes
pkg/disttask/importinto/scheduler.go:467:6: unreachable func: createTableIndexes
pkg/disttask/importinto/scheduler.go:499:6: unreachable func: executeSQL
pkg/disttask/importinto/scheduler_test.go:38:27: unreachable func: importIntoSuite.enableFailPoint
pkg/domain/infosync/info.go:544:6: unreachable func: GetResourceGroup
pkg/domain/infosync/info.go:1237:6: unreachable func: SetEtcdClient
pkg/domain/infosync/info.go:1247:6: unreachable func: GetEtcdClient
pkg/executor/aggregate/agg_hash_base_worker.go:52:29: unreachable func: baseHashAggWorker.getPartialResult
pkg/expression/builtin_func_param.go:43:22: unreachable func: funcParam.setIntVal
pkg/expression/builtin_regexp_util.go:31:32: unreachable func: regexpMemorizedSig.isMemorizedRegexpInitialized
pkg/expression/builtin_regexp_util.go:35:32: unreachable func: regexpMemorizedSig.memorize
pkg/expression/grouping_sets.go:37:6: unreachable func: NewGroupingSets
pkg/infoschema/test/clustertablestest/cluster_tables_test.go:187:6: unreachable func: SubTestDataLockWaitsPrivilege
pkg/infoschema/test/clustertablestest/cluster_tables_test.go:292:6: unreachable func: SubTestSelectClusterTablePrivilege
pkg/kv/kv.go:106:24: unreachable func: EmptyRetriever.Get
pkg/kv/kv.go:111:24: unreachable func: EmptyRetriever.Iter
pkg/kv/kv.go:114:24: unreachable func: EmptyRetriever.IterReverse
pkg/kv/utils.go:68:6: unreachable func: WalkMemBuffer
pkg/meta/meta.go:1287:16: unreachable func: Meta.getDDLJob
pkg/parser/hintparserimpl.go:152:6: unreachable func: ParseHint
pkg/parser/ast/base.go:79:21: unreachable func: stmtNode.statement
pkg/parser/ast/base.go:88:20: unreachable func: ddlNode.ddlStatement
pkg/parser/ast/base.go:97:20: unreachable func: dmlNode.dmlStatement
pkg/parser/ast/base.go:135:21: unreachable func: funcNode.functionExpression
pkg/parser/ast/dml.go:94:14: unreachable func: Join.resultSet
pkg/parser/ast/dml.go:290:19: unreachable func: TableName.resultSet
pkg/parser/ast/dml.go:536:21: unreachable func: TableSource.resultSet
pkg/parser/ast/dml.go:1172:20: unreachable func: SelectStmt.resultSet
pkg/parser/ast/dml.go:1692:20: unreachable func: SetOprStmt.resultSet
pkg/parser/ast/expressions.go:372:22: unreachable func: SubqueryExpr.resultSet
pkg/parser/charset/charset.go:609:6: unreachable func: AddCharset
pkg/parser/charset/charset.go:615:6: unreachable func: RemoveCharset
pkg/parser/charset/encoding.go:137:6: unreachable func: CountValidBytes
pkg/parser/charset/encoding.go:150:6: unreachable func: CountValidBytesDecode
pkg/parser/charset/encoding_table.go:32:6: unreachable func: Lookup
pkg/parser/charset/encoding_table.go:37:6: unreachable func: lookup
pkg/parser/format/format.go:81:6: unreachable func: IndentFormatter
pkg/parser/format/format.go:85:27: unreachable func: indentFormatter.format
pkg/parser/format/format.go:164:27: unreachable func: indentFormatter.Format
pkg/parser/format/format.go:185:6: unreachable func: FlatFormatter
pkg/parser/format/format.go:190:25: unreachable func: flatFormatter.Format
pkg/parser/model/model.go:2127:6: unreachable func: NewStatsOptions
pkg/parser/model/reorg.go:141:25: unreachable func: BackfillMeta.Encode
pkg/parser/model/reorg.go:147:25: unreachable func: BackfillMeta.Decode
pkg/parser/mysql/privs.go:182:6: unreachable func: NewPrivFromColumn
pkg/parser/mysql/privs.go:188:6: unreachable func: NewPrivFromSetEnum
pkg/parser/mysql/type.go:89:6: unreachable func: HasDropColumnWithIndexFlag
pkg/parser/types/etc.go:134:6: unreachable func: StrToType
pkg/planner/cascades/optimize.go:54:23: unreachable func: Optimizer.ResetImplementationRules
pkg/planner/core/common_plans.go:798:6: unreachable func: GetExplainAnalyzeRowsForPlan
pkg/planner/core/planbuilder.go:423:37: unreachable func: PlanBuilderOptAllowCastArray.Apply
pkg/planner/core/preprocess.go:419:6: unreachable func: EraseLastSemicolonInSQL
pkg/planner/core/preprocess.go:698:6: unreachable func: isConstraintKeyTp
pkg/planner/core/scalar_subq_expression.go:192:28: unreachable func: ScalarSubQueryExpr.resolveIndices
pkg/planner/core/scalar_subq_expression.go:207:28: unreachable func: ScalarSubQueryExpr.resolveIndicesByVirtualExpr
pkg/planner/core/task.go:110:19: unreachable func: copTask.count
pkg/planner/core/task.go:801:20: unreachable func: rootTask.count
pkg/planner/core/task.go:2574:19: unreachable func: mppTask.count
pkg/planner/core/util.go:294:6: unreachable func: GetStatsInfoFromFlatPlan
pkg/planner/core/plan_cost_ver1_test.go:28:6: unreachable func: skipPostOptimizedProjection
pkg/planner/core/plan_cost_ver2_test.go:35:6: unreachable func: testCostQueries
pkg/resourcemanager/rm.go:31:6: unreachable func: RandomName
pkg/resourcemanager/pool/basepool.go:44:6: unreachable func: NewBasePool
pkg/resourcemanager/poolmanager/task_manager.go:52:16: unreachable func: Meta.getOriginConcurrency
pkg/resourcemanager/poolmanager/task_manager.go:124:23: unreachable func: TaskManager.hasTask
pkg/server/internal/testserverclient/server_client.go:77:30: unreachable func: TestServerClient.Addr
pkg/session/mock_bootstrap.go:184:22: unreachable func: BaseCallback.OnBootstrapBefore
pkg/session/mock_bootstrap.go:187:22: unreachable func: BaseCallback.OnBootstrap
pkg/session/mock_bootstrap.go:190:22: unreachable func: BaseCallback.OnBootstrapAfter
pkg/sessionctx/variable/session.go:2460:23: unreachable func: SessionVars.setStmtVar
pkg/sessionctx/variable/tidb_vars.go:1612:6: unreachable func: mustParseDuration
pkg/sessiontxn/failpoint.go:171:6: unreachable func: ExecTestHook
pkg/sessiontxn/txn_rc_tso_optimize_test.go:481:6: unreachable func: assertAllTsoCounter
pkg/statistics/cmsketch.go:217:6: unreachable func: updateValueBytes
pkg/statistics/cmsketch.go:230:20: unreachable func: CMSketch.setValue
pkg/statistics/cmsketch.go:791:16: unreachable func: TopN.updateTopNWithDelta
pkg/statistics/index.go:99:19: unreachable func: Index.isStatsInitialized
pkg/statistics/handle/cache/internal/testutil/testutil.go:66:6: unreachable func: MockTableAppendColumn
pkg/statistics/handle/cache/internal/testutil/testutil.go:75:6: unreachable func: MockTableAppendIndex
pkg/statistics/handle/cache/internal/testutil/testutil.go:84:6: unreachable func: MockTableRemoveColumn
pkg/statistics/handle/cache/internal/testutil/testutil.go:89:6: unreachable func: MockTableRemoveIndex
pkg/statistics/handle/syncload/stats_syncload.go:419:23: unreachable func: statsSyncLoad.writeToChanWithTimeout
pkg/statistics/handle/updatetest/update_test.go:658:6: unreachable func: subtraction
pkg/store/driver/tikv_driver.go:78:6: unreachable func: WithTiKVClientConfig
pkg/store/driver/tikv_driver.go:85:6: unreachable func: WithTxnLocalLatches
pkg/store/driver/tikv_driver.go:92:6: unreachable func: WithPDClientConfig
pkg/store/gcworker/gc_worker.go:1058:20: unreachable func: GCWorker.getStoresMapForGC
pkg/store/mockstore/mockstore.go:233:6: unreachable func: copyImage
pkg/store/mockstore/unistore/config/config.go:161:6: unreachable func: ParseDuration
pkg/store/mockstore/unistore/pd/client.go:87:6: unreachable func: NewClient
pkg/store/mockstore/unistore/pd/client.go:133:18: unreachable func: client.schedulerUpdateLeader
pkg/store/mockstore/unistore/pd/client.go:140:18: unreachable func: client.checkLeaderLoop
pkg/store/mockstore/unistore/pd/client.go:162:18: unreachable func: client.updateLeader
pkg/store/mockstore/unistore/pd/client.go:182:18: unreachable func: client.updateURLs
pkg/store/mockstore/unistore/pd/client.go:193:18: unreachable func: client.switchLeader
pkg/store/mockstore/unistore/pd/client.go:215:18: unreachable func: client.getMembers
pkg/store/mockstore/unistore/pd/client.go:223:18: unreachable func: client.getOrCreateConn
pkg/store/mockstore/unistore/pd/client.go:249:18: unreachable func: client.leaderClient
pkg/store/mockstore/unistore/pd/client.go:256:18: unreachable func: client.doRequest
pkg/store/mockstore/unistore/pd/client.go:278:18: unreachable func: client.heartbeatStreamLoop
pkg/store/mockstore/unistore/pd/client.go:320:18: unreachable func: client.receiveRegionHeartbeat
pkg/store/mockstore/unistore/pd/client.go:335:18: unreachable func: client.reportRegionHeartbeat
pkg/store/mockstore/unistore/pd/client.go:353:18: unreachable func: client.getNextHeartbeatRequest
pkg/store/mockstore/unistore/pd/client.go:371:18: unreachable func: client.Close
pkg/store/mockstore/unistore/pd/client.go:384:18: unreachable func: client.GetClusterID
pkg/store/mockstore/unistore/pd/client.go:388:18: unreachable func: client.AllocID
pkg/store/mockstore/unistore/pd/client.go:403:18: unreachable func: client.Bootstrap
pkg/store/mockstore/unistore/pd/client.go:416:18: unreachable func: client.IsBootstrapped
pkg/store/mockstore/unistore/pd/client.go:432:18: unreachable func: client.PutStore
pkg/store/mockstore/unistore/pd/client.go:451:18: unreachable func: client.GetStore
pkg/store/mockstore/unistore/pd/client.go:470:18: unreachable func: client.GetAllStores
pkg/store/mockstore/unistore/pd/client.go:489:18: unreachable func: client.GetClusterConfig
pkg/store/mockstore/unistore/pd/client.go:507:18: unreachable func: client.GetRegion
pkg/store/mockstore/unistore/pd/client.go:534:18: unreachable func: client.GetRegionByID
pkg/store/mockstore/unistore/pd/client.go:561:18: unreachable func: client.AskSplit
pkg/store/mockstore/unistore/pd/client.go:579:18: unreachable func: client.AskBatchSplit
pkg/store/mockstore/unistore/pd/client.go:598:18: unreachable func: client.ReportBatchSplit
pkg/store/mockstore/unistore/pd/client.go:617:18: unreachable func: client.GetGCSafePoint
pkg/store/mockstore/unistore/pd/client.go:635:18: unreachable func: client.StoreHeartbeat
pkg/store/mockstore/unistore/pd/client.go:654:18: unreachable func: client.GetTS
pkg/store/mockstore/unistore/pd/client.go:680:18: unreachable func: client.ReportRegion
pkg/store/mockstore/unistore/pd/client.go:684:18: unreachable func: client.SetRegionHeartbeatResponseHandler
pkg/store/mockstore/unistore/pd/client.go:691:18: unreachable func: client.requestHeader
pkg/store/mockstore/unistore/server/server.go:69:6: unreachable func: New
pkg/store/mockstore/unistore/server/server.go:93:6: unreachable func: getRegionOptions
pkg/store/mockstore/unistore/tikv/region.go:195:22: unreachable func: regionCtx.greaterEqualEndKey
pkg/store/mockstore/unistore/tikv/region.go:408:6: unreachable func: NewStandAloneRegionManager
pkg/store/mockstore/unistore/tikv/region.go:452:36: unreachable func: StandAloneRegionManager.initStore
pkg/store/mockstore/unistore/tikv/region.go:512:36: unreachable func: StandAloneRegionManager.initialSplit
pkg/store/mockstore/unistore/tikv/region.go:537:36: unreachable func: StandAloneRegionManager.allocIDs
pkg/store/mockstore/unistore/tikv/region.go:549:36: unreachable func: StandAloneRegionManager.storeHeartBeatLoop
pkg/store/mockstore/unistore/tikv/region.go:585:6: unreachable func: newSampler
pkg/store/mockstore/unistore/tikv/region.go:589:19: unreachable func: sampler.shrinkIfNeeded
pkg/store/mockstore/unistore/tikv/region.go:600:19: unreachable func: sampler.shouldSample
pkg/store/mockstore/unistore/tikv/region.go:605:19: unreachable func: sampler.scanKey
pkg/store/mockstore/unistore/tikv/region.go:619:19: unreachable func: sampler.getSplitKeyAndSize
pkg/store/mockstore/unistore/tikv/region.go:629:36: unreachable func: StandAloneRegionManager.runSplitWorker
pkg/store/mockstore/unistore/tikv/region.go:667:36: unreachable func: StandAloneRegionManager.saveSize
pkg/store/mockstore/unistore/tikv/region.go:687:36: unreachable func: StandAloneRegionManager.splitCheckRegion
pkg/store/mockstore/unistore/tikv/region.go:720:36: unreachable func: StandAloneRegionManager.splitRegion
pkg/store/mockstore/unistore/tikv/region.go:789:36: unreachable func: StandAloneRegionManager.SplitRegion
pkg/store/mockstore/unistore/tikv/region.go:794:36: unreachable func: StandAloneRegionManager.Close
pkg/store/mockstore/unistore/tikv/mvcc/db_writer.go:64:6: unreachable func: NewDBSnapshot
pkg/store/mockstore/unistore/tikv/mvcc/mvcc.go:180:6: unreachable func: DecodeExtraTxnStatusKey
pkg/store/mockstore/unistore/tikv/mvcc/tikv.go:45:6: unreachable func: ParseWriteCFValue
pkg/store/mockstore/unistore/tikv/mvcc/tikv.go:72:6: unreachable func: EncodeWriteCFValue
pkg/store/mockstore/unistore/tikv/mvcc/tikv.go:84:6: unreachable func: EncodeLockCFValue
pkg/store/mockstore/unistore/tikv/pberror/pberror.go:27:20: unreachable func: PBError.Error
pkg/store/pdtypes/typeutil.go:65:6: unreachable func: NewDuration
pkg/store/pdtypes/typeutil.go:104:22: unreachable func: StringSlice.MarshalJSON
pkg/store/pdtypes/typeutil.go:109:23: unreachable func: StringSlice.UnmarshalJSON
pkg/table/tables/index.go:653:6: unreachable func: FindChangingCol
pkg/testkit/stepped.go:246:27: unreachable func: SteppedTestKit.GetResult
pkg/testkit/testutil/require.go:81:6: unreachable func: RandStringRunes
pkg/tidb-binlog/driver/reader/offset.go:54:24: unreachable func: KafkaSeeker.Close
pkg/tidb-binlog/driver/reader/reader.go:58:18: unreachable func: Config.getSaramaBufferSize
pkg/tidb-binlog/driver/reader/reader.go:66:18: unreachable func: Config.getMessageBufferSize
pkg/tidb-binlog/driver/reader/reader.go:74:18: unreachable func: Config.valid
pkg/tidb-binlog/driver/reader/reader.go:98:18: unreachable func: Reader.getTopic
pkg/tidb-binlog/driver/reader/reader.go:107:6: unreachable func: NewReader
pkg/tidb-binlog/driver/reader/reader.go:150:18: unreachable func: Reader.Close
pkg/tidb-binlog/driver/reader/reader.go:157:18: unreachable func: Reader.Messages
pkg/tidb-binlog/driver/reader/reader.go:161:18: unreachable func: Reader.getOffsetByTS
pkg/tidb-binlog/driver/reader/reader.go:186:18: unreachable func: Reader.run
pkg/timer/runtime/main_test.go:107:25: unreachable func: mockStoreCore.mock
pkg/ttl/ttlworker/job.go:70:6: unreachable func: updateJobCurrentStatusSQL
pkg/ttl/ttlworker/job_manager_test.go:206:6: unreachable func: newMockTTLJob
pkg/types/field_type_builder.go:28:28: unreachable func: FieldTypeBuilder.GetType
pkg/types/field_type_builder.go:33:28: unreachable func: FieldTypeBuilder.GetFlag
pkg/types/field_type_builder.go:38:28: unreachable func: FieldTypeBuilder.GetFlen
pkg/types/field_type_builder.go:43:28: unreachable func: FieldTypeBuilder.GetDecimal
pkg/types/field_type_builder.go:48:28: unreachable func: FieldTypeBuilder.GetCharset
pkg/types/field_type_builder.go:53:28: unreachable func: FieldTypeBuilder.GetCollate
pkg/types/field_type_builder.go:76:28: unreachable func: FieldTypeBuilder.ToggleFlag
pkg/types/field_type_builder.go:82:28: unreachable func: FieldTypeBuilder.DelFlag
pkg/util/cpu_posix.go:30:6: unreachable func: GetCPUPercentage
pkg/util/printer.go:35:6: unreachable func: GetRawInfo
pkg/util/printer.go:48:6: unreachable func: PrintInfo
pkg/util/util.go:37:6: unreachable func: SliceToMap
pkg/util/util.go:69:6: unreachable func: GetJSON
pkg/util/cgroup/cgroup.go:91:6: unreachable func: SetGOMAXPROCS
pkg/util/cgroup/cgroup_cpu_unsupport.go:42:6: unreachable func: CPUQuotaToGOMAXPROCS
pkg/util/cgroup/cgroup_memory.go:43:6: unreachable func: GetMemoryInactiveFileUsage
pkg/util/chunk/alloc.go:78:26: unreachable func: columnList.add
pkg/util/column-mapping/column.go:221:19: unreachable func: Mapping.UpdateRule
pkg/util/column-mapping/column.go:226:19: unreachable func: Mapping.RemoveRule
pkg/util/dbutil/common.go:74:20: unreachable func: DBConfig.String
pkg/util/dbutil/common.go:83:6: unreachable func: GetDBConfigFromEnv
pkg/util/dbutil/common.go:108:6: unreachable func: OpenDB
pkg/util/dbutil/common.go:137:6: unreachable func: CloseDB
pkg/util/dbutil/common.go:146:6: unreachable func: GetCreateTableSQL
pkg/util/dbutil/common.go:175:6: unreachable func: GetRowCount
pkg/util/dbutil/common.go:205:6: unreachable func: GetRandomValues
pkg/util/dbutil/common.go:252:6: unreachable func: GetMinMaxValue
pkg/util/dbutil/common.go:338:6: unreachable func: queryTables
pkg/util/dbutil/common.go:365:6: unreachable func: GetTables
pkg/util/dbutil/common.go:382:6: unreachable func: GetViews
pkg/util/dbutil/common.go:388:6: unreachable func: GetSchemas
pkg/util/dbutil/common.go:422:6: unreachable func: GetCRC32Checksum
pkg/util/dbutil/common.go:465:6: unreachable func: GetBucketsInfo
pkg/util/dbutil/common.go:591:6: unreachable func: GetTidbLatestTSO
pkg/util/dbutil/common.go:623:6: unreachable func: GetDBVersion
pkg/util/dbutil/common.go:665:6: unreachable func: GetSessionVariable
pkg/util/dbutil/common.go:698:6: unreachable func: GetSQLMode
pkg/util/dbutil/common.go:709:6: unreachable func: IsTiDB
pkg/util/dbutil/common.go:746:6: unreachable func: ExecSQLWithRetry
pkg/util/dbutil/common.go:784:6: unreachable func: ExecuteSQLs
pkg/util/dbutil/common.go:880:6: unreachable func: GetParserForDB
pkg/util/dbutil/index.go:38:6: unreachable func: ShowIndex
pkg/util/dbutil/index.go:89:6: unreachable func: FindSuitableColumnWithIndex
pkg/util/dbutil/index.go:174:6: unreachable func: SelectUniqueOrderKey
pkg/util/dbutil/query.go:24:6: unreachable func: ScanRowsToInterfaces
pkg/util/dbutil/query.go:51:6: unreachable func: ScanRow
pkg/util/dbutil/table.go:38:6: unreachable func: GetTableInfo
pkg/util/dbutil/types.go:22:6: unreachable func: IsNumberType
pkg/util/dbutil/types.go:32:6: unreachable func: IsFloatType
pkg/util/dbutil/variable.go:30:6: unreachable func: ShowVersion
pkg/util/dbutil/variable.go:35:6: unreachable func: ShowLogBin
pkg/util/dbutil/variable.go:40:6: unreachable func: ShowBinlogFormat
pkg/util/dbutil/variable.go:45:6: unreachable func: ShowBinlogRowImage
pkg/util/dbutil/variable.go:50:6: unreachable func: ShowServerID
pkg/util/dbutil/variable.go:61:6: unreachable func: ShowMySQLVariable
pkg/util/ddl-checker/ddl_syncer.go:32:6: unreachable func: NewDDLSyncer
pkg/util/ddl-checker/ddl_syncer.go:41:22: unreachable func: DDLSyncer.SyncTable
pkg/util/ddl-checker/ddl_syncer.go:58:22: unreachable func: DDLSyncer.Close
pkg/util/ddl-checker/executable_checker.go:69:30: unreachable func: ExecutableChecker.Execute
pkg/util/ddl-checker/executable_checker.go:78:30: unreachable func: ExecutableChecker.IsTableExist
pkg/util/ddl-checker/executable_checker.go:85:30: unreachable func: ExecutableChecker.CreateTable
pkg/util/ddl-checker/executable_checker.go:94:30: unreachable func: ExecutableChecker.DropTable
pkg/util/ddl-checker/executable_checker.go:161:6: unreachable func: IsDDL
pkg/util/disttask/idservice.go:33:6: unreachable func: MatchServerInfo
pkg/util/disttask/idservice.go:38:6: unreachable func: FindServerInfo
pkg/util/gctuner/tuner.go:92:6: unreachable func: GetGOGC
pkg/util/importer/config.go:34:18: unreachable func: Config.String
pkg/util/importer/data.go:36:6: unreachable func: newDatum
pkg/util/importer/data.go:40:17: unreachable func: datum.setInitInt64Value
pkg/util/importer/data.go:63:17: unreachable func: datum.uniqInt64
pkg/util/importer/data.go:79:17: unreachable func: datum.uniqFloat64
pkg/util/importer/data.go:84:17: unreachable func: datum.uniqString
pkg/util/importer/data.go:113:17: unreachable func: datum.uniqTime
pkg/util/importer/data.go:126:17: unreachable func: datum.uniqDate
pkg/util/importer/data.go:139:17: unreachable func: datum.uniqTimestamp
pkg/util/importer/data.go:154:17: unreachable func: datum.uniqYear
pkg/util/importer/db.go:31:6: unreachable func: intRangeValue
pkg/util/importer/db.go:50:6: unreachable func: randInt64Value
pkg/util/importer/db.go:61:6: unreachable func: uniqInt64Value
pkg/util/importer/db.go:67:6: unreachable func: genRowDatas
pkg/util/importer/db.go:80:6: unreachable func: genRowData
pkg/util/importer/db.go:96:6: unreachable func: genColumnData
pkg/util/importer/db.go:217:6: unreachable func: execSQL
pkg/util/importer/db.go:230:6: unreachable func: createDB
pkg/util/importer/db.go:240:6: unreachable func: closeDB
pkg/util/importer/db.go:244:6: unreachable func: createDBs
pkg/util/importer/db.go:258:6: unreachable func: closeDBs
pkg/util/importer/importer.go:23:6: unreachable func: DoProcess
pkg/util/importer/job.go:26:6: unreachable func: addJobs
pkg/util/importer/job.go:34:6: unreachable func: doInsert
pkg/util/importer/job.go:58:6: unreachable func: doJob
pkg/util/importer/job.go:75:6: unreachable func: doWait
pkg/util/importer/job.go:93:6: unreachable func: doProcess
pkg/util/importer/parser.go:45:20: unreachable func: column.String
pkg/util/importer/parser.go:54:20: unreachable func: column.parseRule
pkg/util/importer/parser.go:86:20: unreachable func: column.parseColumnComment
pkg/util/importer/parser.go:103:20: unreachable func: column.parseColumn
pkg/util/importer/parser.go:111:20: unreachable func: column.parseColumnOptions
pkg/util/importer/parser.go:131:17: unreachable func: table.printColumns
pkg/util/importer/parser.go:140:17: unreachable func: table.String
pkg/util/importer/parser.go:164:6: unreachable func: newTable
pkg/util/importer/parser.go:172:15: unreachable func: table.findCol
pkg/util/importer/parser.go:181:17: unreachable func: table.parseTableConstraint
pkg/util/importer/parser.go:197:17: unreachable func: table.buildColumnList
pkg/util/importer/parser.go:206:6: unreachable func: parseTable
pkg/util/importer/parser.go:224:6: unreachable func: parseTableSQL
pkg/util/importer/parser.go:240:6: unreachable func: parseIndex
pkg/util/importer/parser.go:257:6: unreachable func: parseIndexSQL
pkg/util/importer/rand.go:37:6: unreachable func: randInt
pkg/util/importer/rand.go:41:6: unreachable func: randInt64
pkg/util/importer/rand.go:46:6: unreachable func: randFloat64
pkg/util/importer/rand.go:54:6: unreachable func: randBool
pkg/util/importer/rand.go:60:6: unreachable func: randString
pkg/util/importer/rand.go:79:6: unreachable func: randDuration
pkg/util/importer/rand.go:84:6: unreachable func: randDate
pkg/util/importer/rand.go:104:6: unreachable func: randTime
pkg/util/importer/rand.go:119:6: unreachable func: randTimestamp
pkg/util/importer/rand.go:142:6: unreachable func: randYear
pkg/util/intset/fast_int_set_test.go:36:18: unreachable func: IntSet.SubsetOf
pkg/util/intset/fast_int_set_test.go:47:18: unreachable func: IntSet.Intersects
pkg/util/intset/fast_int_set_test.go:57:18: unreachable func: IntSet.Difference
pkg/util/intset/fast_int_set_test.go:74:18: unreachable func: IntSet.Union
pkg/util/intset/fast_int_set_test.go:85:18: unreachable func: IntSet.Equals
pkg/util/intset/fast_int_set_test.go:97:19: unreachable func: IntSet.CopyFrom
pkg/util/intset/fast_int_set_test.go:102:18: unreachable func: IntSet.SortedArray
pkg/util/intset/fast_int_set_test.go:119:6: unreachable func: NewIntSetWithCap
pkg/util/logutil/log.go:334:6: unreachable func: Event
pkg/util/logutil/log.go:348:6: unreachable func: SetTag
pkg/util/serialization/deserialization_util.go:67:6: unreachable func: DeserializeInt8
pkg/util/serialization/deserialization_util.go:74:6: unreachable func: DeserializeUint8
pkg/util/serialization/deserialization_util.go:81:6: unreachable func: DeserializeInt32
pkg/util/serialization/deserialization_util.go:88:6: unreachable func: DeserializeUint32
pkg/util/serialization/serialization_util.go:51:6: unreachable func: SerializeInt8
pkg/util/serialization/serialization_util.go:58:6: unreachable func: SerializeUint8
pkg/util/serialization/serialization_util.go:65:6: unreachable func: SerializeInt32
pkg/util/serialization/serialization_util.go:72:6: unreachable func: SerializeUint32
pkg/util/serialization/serialization_util.go:134:6: unreachable func: SerializeJSONTypeCode
pkg/util/set/mem_aware_map.go:36:6: unreachable func: EstimateMapSize
pkg/util/table-filter/compat.go:33:17: unreachable func: Table.lessThan
pkg/util/tiflashcompute/topo_fetcher.go:209:27: unreachable func: MockTopoFetcher.assureTopo
pkg/util/watcher/event.go:35:14: unreachable func: Op.String
pkg/util/watcher/watcher.go:128:19: unreachable func: Watcher.Remove
tests/realtikvtest/importintotest2/main_test.go:78:24: unreachable func: mockGCSSuite.cleanupSysTables
tests/realtikvtest/importintotest3/main_test.go:71:24: unreachable func: mockGCSSuite.enableFailpoint
tests/realtikvtest/importintotest3/main_test.go:78:24: unreachable func: mockGCSSuite.cleanupSysTables
tests/realtikvtest/importintotest4/main_test.go:78:24: unreachable func: mockGCSSuite.cleanupSysTables
tests/realtikvtest/pessimistictest/pessimistic_test.go:2461:6: unreachable func: createTable

We can remove some of them.

YangKeao commented 5 months ago

Some of these functions are dependent by tiflow and tidb-tools, so please be careful not to break them. I'll find some way to also consider these repos 🤔 .

Defined2014 commented 5 months ago

Does it include some functions only be used in *test.go?