Skip to content

Cleaning up unused code by enabling golangci-lint unused #61967

@zimulala

Description

@zimulala

Enhancement

The unused code can be obtained through the following instructions:
golangci-lint run --no-config --disable-all --enable=unused --timeout=30m --skip-files=".*_test\.go" ./pkg/...

Rest:

pkg/resourcemanager/poolmanager/task_manager.go:52:16: func `(*Meta).getOriginConcurrency` is unused (unused)
func (m *Meta) getOriginConcurrency() int32 {
               ^
pkg/resourcemanager/poolmanager/task_manager.go:124:23: func `(*TaskManager).hasTask` is unused (unused)
func (t *TaskManager) hasTask(taskID uint64) bool {
                      ^
pkg/util/cgroup/cgroup_cpu.go:24:5: var `errNoCPUControllerDetected` is unused (unused)
var errNoCPUControllerDetected = errors.New("no cpu controller detected")
    ^
pkg/sessionctx/vardef/tidb_vars.go:1804:6: func `mustParseDuration` is unused (unused)
func mustParseDuration(str string) time.Duration {
     ^
pkg/util/tiflashcompute/topo_fetcher.go:161:27: func `(*MockTopoFetcher).assureTopo` is unused (unused)
func (f *MockTopoFetcher) assureTopo(nodeNum int) error {
                          ^
pkg/store/mockstore/unistore/tikv/mvcc/tikv.go:131:5: var `errInvalidLockCFValue` is unused (unused)
var errInvalidLockCFValue = errors.New("invalid lock CF value")
    ^
pkg/sessionctx/stmtctx/stmtctx.go:71:6: type `jsonSQLWarn` is unused (unused)
type jsonSQLWarn struct {
     ^
pkg/kv/kv.go:792:2: field `accessKey` is unused (unused)
	accessKey    []byte
	^
pkg/timer/api/store.go:50:26: func `(*OptionalVal[T]).internalPresent` is unused (unused)
func (o *OptionalVal[T]) internalPresent() bool {
                         ^
pkg/table/tables/tables.go:1469:23: func `(*TableCommon).canSkipUpdateBinlog` is unused (unused)
func (t *TableCommon) canSkipUpdateBinlog(col *table.Column) bool {
                      ^
pkg/owner/mock.go:45:2: field `retireHook` is unused (unused)
	retireHook   func()
	^
pkg/distsql/select_result.go:52:2: var `errQueryInterrupted` is unused (unused)
	errQueryInterrupted = dbterror.ClassExecutor.NewStd(errno.ErrQueryInterrupted)
	^
pkg/store/mockstore/mockstore.go:272:6: func `copyImage` is unused (unused)
func copyImage() (string, error) {
     ^
pkg/workloadlearning/handle.go:115:16: func `(*Handle).analyzeBasedOnStatementSummary` is unused (unused)
func (*Handle) analyzeBasedOnStatementSummary() []*TableReadCostMetrics {
               ^
pkg/workloadlearning/handle.go:338:6: func `checkCrossDB` is unused (unused)
func checkCrossDB(sql string) (bool, error) {
     ^
pkg/ttl/ttlworker/job.go:123:2: field `statusMutex` is unused (unused)
	statusMutex sync.Mutex
	^
pkg/ttl/ttlworker/session.go:60:5: var `allIsolationReadEngines` is unused (unused)
var allIsolationReadEngines = map[kv.StoreType]struct{}{
    ^
pkg/executor/join/hash_join_test_util.go:147:6: func `buildDataSource` is unused (unused)
func buildDataSource(sortCase *testutil.SortCase, schema *expression.Schema) *testutil.MockDataSource {
......

Metadata

Metadata

Assignees

No one assigned

    Labels

    first-time-contributorIndicates that the PR was contributed by an external member and is a first-time contributor.good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.type/enhancementThe issue or PR belongs to an enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions