Skip to content

*: fix golangci-lint auto-fixable issues (PR 2 of 4)#5033

Open
3AceShowHand wants to merge 6 commits into
pingcap:masterfrom
3AceShowHand:pr-2-fix-autofix-regressions
Open

*: fix golangci-lint auto-fixable issues (PR 2 of 4)#5033
3AceShowHand wants to merge 6 commits into
pingcap:masterfrom
3AceShowHand:pr-2-fix-autofix-regressions

Conversation

@3AceShowHand
Copy link
Copy Markdown
Collaborator

@3AceShowHand 3AceShowHand commented May 12, 2026

Issue Number: close #5034

What problem does this PR solve?

Part of the 4-PR plan (tracked in #5032) to fix all golangci-lint issues. This PR fixes auto-fixable issues (--fix) plus selected mechanical non-auto-fixable bugs.

What is changed and how it works?

Auto-fixed (no manual changes):

  • copyloopvar (12): remove redundant x := x in Go 1.22+ loop variables
  • misspell (13): fix typos in comments and strings
  • nosprintfhostport (auto): use net.JoinHostPort instead of Sprintf
  • govet (1): fix WriteHeader order in oauth2-server, use http.StatusOK constant

Manual fixes:

  • ineffassign (2): remove dead assignments in consumer.go, drop_event.go
  • nilerr (3): return err instead of nil in file.go, mysql_writer_ddl.go, pool_test.go
    • pkg/redo/writer/file/file.go: flushAndRotateFile has already flushed the local file, but external-storage mode still needs rotate() to rename/sync the file, upload it to external storage, and open the next file. Swallowing a rotate() error would make Flush() look successful and can trigger redo PostFlush() before the log is durable in external storage, so returning the error is the safer and correct behavior.
    • pkg/sink/mysql/mysql_writer_ddl.go: isDDLExecuted guards non-idempotent ExchangeTablePartition DDLs. If the check fails, treating it as success can skip the actual DDL while later code may still advance ddl-ts metadata and call PostFlush(). Returning the error lets the existing DDL retry/error path preserve downstream correctness.
  • durationcheck (1): avoid multiplying two time.Duration values in sync_point.go
  • log key consistency: "commits""commitTs" in barrier.go

Skipped (false positives or need design):

  • errname: renaming error types touches 8+ files — deferred to follow-up
  • govet (remaining): testinggoroutine, copylocks need design decisions
  • unconvert: platform-dependent type conversions

Check List

Tests:

  • Unit test: go build ./... passes

Code changes:

  • Has Go code changes
  • Does not change pkg/errors imports (deferred to PR 3)

Related changes:

Release note

None

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Corrected error propagation in redo log file rotation when using external storage.
    • Fixed error handling for DDL execution status checks.
  • Refactor

    • Improved code maintainability through loop and conditional statement restructuring across multiple components.
    • Optimized string formatting operations for better performance.
  • Tests

    • Enhanced test suite reliability by removing loop variable shadowing patterns in parallel test execution.
  • Documentation

    • Corrected various spelling and comment inaccuracies throughout the codebase.

…e bugs

Auto-fixed by `golangci-lint run --fix -D errorlint`:
- copyloopvar: remove redundant "x := x" in Go 1.22+ loop variables
- misspell: fix typos in comments and strings
- nosprintfhostport: use net.JoinHostPort instead of Sprintf

Manual fixes:
- ineffassign (2): remove dead assignments in consumer.go, drop_event.go
- nilerr (3): return err instead of nil in file.go, mysql_writer_ddl.go, pool_test.go
- durationcheck (1): avoid multiplying two time.Duration values in sync_point.go

Skipped in this PR (false positives or need more context):
- unconvert: platform-dependent type conversions
- govet: testinggoroutine, copylocks need design decisions
- errname: renaming error types touches 8+ files
- remaining ineffassign: need verification
@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. labels May 12, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 12, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign flowbehappy for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 12, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request performs extensive code cleanup and optimizations, including refactoring loops and conditionals into more idiomatic Go structures, replacing inefficient string formatting with fmt.Fprintf, and fixing various typos in comments and error messages. It also addresses several bugs where errors were being swallowed instead of returned, specifically in pkg/redo/writer/file/file.go, pkg/sink/mysql/mysql_writer_ddl.go, and pkg/workerpool/pool_test.go. Feedback was provided to improve log consistency by using the standard commitTs key instead of commits in maintainer/barrier.go.

Comment thread maintainer/barrier.go Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1e66ce8e-a7b7-4485-9eec-1b7a145248ae

📥 Commits

Reviewing files that changed from the base of the PR and between 1ce250a and 4390af7.

📒 Files selected for processing (24)
  • cmd/kafka-consumer/writer.go
  • cmd/oauth2-server/main.go
  • cmd/storage-consumer/consumer.go
  • coordinator/changefeed/backoff_test.go
  • coordinator/controller.go
  • downstreamadapter/eventcollector/dispatcher_stat_test.go
  • downstreamadapter/routing/ddl_query_rewriter_test.go
  • downstreamadapter/routing/router_apply_test.go
  • downstreamadapter/routing/router_supported_ddl_test.go
  • maintainer/barrier.go
  • maintainer/scheduler/drain_test.go
  • pkg/applier/redo.go
  • pkg/common/format_test.go
  • pkg/common/helper_test.go
  • pkg/common/table_info_shared_schema_guard_test.go
  • pkg/common/table_info_test.go
  • pkg/common/table_name_test.go
  • pkg/messaging/remote_target.go
  • pkg/notify/notify_test.go
  • pkg/security/sasl_test.go
  • pkg/sink/kafka/sarama_config_test.go
  • pkg/sink/mysql/mysql_writer_dml_test.go
  • tests/integration_tests/many_pk_or_uk/main.go
  • utils/threadpool/thread_pool_test.go
💤 Files with no reviewable changes (15)
  • pkg/common/helper_test.go
  • downstreamadapter/routing/router_supported_ddl_test.go
  • pkg/common/table_name_test.go
  • pkg/notify/notify_test.go
  • pkg/sink/mysql/mysql_writer_dml_test.go
  • downstreamadapter/routing/ddl_query_rewriter_test.go
  • pkg/security/sasl_test.go
  • pkg/sink/kafka/sarama_config_test.go
  • coordinator/changefeed/backoff_test.go
  • pkg/common/table_info_test.go
  • pkg/common/table_info_shared_schema_guard_test.go
  • pkg/common/format_test.go
  • maintainer/scheduler/drain_test.go
  • downstreamadapter/eventcollector/dispatcher_stat_test.go
  • downstreamadapter/routing/router_apply_test.go
✅ Files skipped from review due to trivial changes (3)
  • utils/threadpool/thread_pool_test.go
  • maintainer/barrier.go
  • cmd/kafka-consumer/writer.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • coordinator/controller.go
  • pkg/applier/redo.go
  • pkg/messaging/remote_target.go
  • cmd/storage-consumer/consumer.go
  • cmd/oauth2-server/main.go

📝 Walkthrough

Walkthrough

Large refactor across many files: remove test loop shadowing, adopt fmt.Fprintf for builder writes, simplify loops and if/else chains to switches, inline boolean expressions, use promoted fields/getters, apply targeted bug fixes, and correct comments/tests.

Changes

Core Refactor: Loops, Control Flow, and String Formatting

Layer / File(s) Summary
Formatting and builder writes
pkg/common/format.go, maintainer/operator/*, maintainer/range_checker/*, maintainer/replica/split_span_checker.go, pkg/sink/mysql/sql_builder.go, pkg/sink/mysql/mysql_writer_for_syncpoint.go, tests/integration_tests/cdc/dailytest/case.go, pkg/version/check_test.go
Replace intermediate fmt.Sprintf+WriteString with direct fmt.Fprintf(&sb, ...) in many formatting and logging paths.
Test loop variable capture cleanup
coordinator/changefeed/*_test.go, downstreamadapter/*_test.go, pkg/common/*_test.go, pkg/security/*_test.go, pkg/sink/*_test.go, maintainer/scheduler/drain_test.go, pkg/notify/notify_test.go, pkg/orchestrator/batch_test.go, tests/integration_tests/*
Remove per-iteration loop-variable shadowing so subtests and goroutines capture the loop variable directly (consistent with modern Go).
Loop condition simplification
coordinator/controller.go, pkg/messaging/remote_target.go, pkg/eventservice/event_broker.go, pkg/applier/redo.go, utils/chann/unlimited_chann.go, downstreamadapter/sink/redo/meta.go
Replace sentinel infinite for { if cond { break } } patterns with direct for cond { } loops; preserve ctx cancellation and existing behavior.
If-else to switch conversions
maintainer/replica/split_span_checker.go, maintainer/scheduler/balance_splits.go, pkg/diff/checkpoint.go, pkg/redo/reader/reader_test.go, pkg/sink/codec/csv/csv_message_test.go, pkg/pdutil/api_client_test.go, tests/integration_tests/cdc/dailytest/parser.go, tests/integration_tests/multi_source/main.go
Refactor multi-branch if/else to switch statements while keeping semantics unchanged.
Promoted field and getter usage
downstreamadapter/dispatcher/*, downstreamadapter/dispatchermanager/*, pkg/messaging/message.go, pkg/etcd/client.go, pkg/common/table_info_helper.go
Access promoted fields and call getters instead of traversing embedded structs; update heartbeat/status field writes and logging ID sources.
Boolean expression simplifications
cmd/kafka-consumer/writer.go, downstreamadapter/sink/redo/meta.go, pkg/eventservice/event_service_test.go, pkg/eventservice/scan_window.go, pkg/diff/util.go, logservice/eventstore/event_store.go
Convert multi-step boolean assignments and negations to single expressions or apply De Morgan's transformations with no semantic change.
String utilities and small API updates
pkg/common/table_info.go, pkg/diff/diff.go, cmd/oauth2-server/main.go, logservice/schemastore/schema_store_test.go
Use strings.ReplaceAll for escaping, adjust table-name references, and update response writing to use fmt.Fprintf and proper headers.

Bug Fixes and Behavioral Logic Changes

Layer / File(s) Summary
Error propagation and logic fixes
pkg/redo/writer/file/file.go, pkg/sink/mysql/mysql_writer_ddl.go, cmd/pulsar-consumer/consumer.go, cmd/storage-consumer/consumer.go, pkg/upstream/upstream.go, pkg/workerpool/pool_test.go
Return rotation errors, propagate DDL-check errors, use the correct Pulsar message ID for Ack, remove fallback schema in RENAME parsing, marshal full topology config, and surface AddEvent errors in test goroutines.
Config and arithmetic corrections
downstreamadapter/syncpoint/sync_point.go, pkg/sink/codec/common/config.go, tests/integration_tests/util/config.go
Apply explicit int64 conversions in sync-point arithmetic, rewrite validation condition forms, and use wrapper arg access for leftover-arg checks.
DropEvent and misc updates
pkg/common/event/drop_event.go, utils/threadpool/thread_pool_test.go, pkg/security/scram_client.go, pkg/binlog-filter/filter_test.go
Remove redundant offset increments in DropEvent encode/decode, prefer type inference in a test, update SCRAM client construction, and call public filter API in tests.

Comment and Documentation Corrections

Layer / File(s) Summary
Spelling and doc fixes
pkg/common/span_op.go, coordinator/changefeed/etcd_backend_test.go, server/server.go, pkg/sink/mysql/mysql_writer_test.go, pkg/sink/codec/common/config.go, tests/integration_tests/default_value/main.go, downstreamadapter/dispatchermanager/dispatcher_manager.go, maintainer/barrier.go, tests/integration_tests/api_v2/cases.go, tests/integration_tests/multi_source/main.go
Correct multiple typos and minor comment wording without changing logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

lgtm, approved, size/M, ok-to-test

Suggested reviewers

  • asddongmen
  • wk989898
  • flowbehappy

Poem

"I hopped through code both far and near,
Cleared shadows and made fmt prints clear,
Switches, loops, and tests aligned,
A rabbit's tidy patch — joy to find!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fixing golangci-lint auto-fixable issues as part 2 of a 4-PR plan.
Description check ✅ Passed The description includes the issue number, clearly explains the problem and changes, lists all modifications categorized by type, and provides test validation.
Linked Issues check ✅ Passed The PR fully addresses #5034's objectives: applies auto-fixes for copyloopvar, misspell, and selected manual fixes for ineffassign, nilerr, and durationcheck as required.
Out of Scope Changes check ✅ Passed All code changes are directly related to fixing golangci-lint issues (loop variables, typos, dead assignments, error handling) as specified in #5034; no unrelated changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cmd/storage-consumer/consumer.go (1)

564-579: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: Restore the schema fallback for RENAME TABLE without explicit schema.

When a RENAME TABLE statement omits the schema (e.g., RENAME TABLE t1 TO t2), the TiDB parser sets oldTable.Schema.O to an empty string. The current code leaves schemaName empty in this case, but it should default to tableDef.Schema (the current schema context).

This breaks the old-table key used for DDL watermark tracking (line 588-590), causing incorrect filtering of DML files and potential data corruption.

🐛 Proposed fix to restore schema fallback
-	var schemaName, tableName string
 	stmt, err := parser.New().ParseOneStmt(tableDef.Query, "", "")
 	if err != nil {
 		log.Panic("parse statement failed", zap.Any("DDL", tableDef.Query), zap.Error(err))
 	}
 	// The query in job maybe "RENAME TABLE table1 to table2"
 	renameStmt, ok := stmt.(*ast.RenameTableStmt)
 	if !ok || len(renameStmt.TableToTables) == 0 {
 		log.Panic("invalid rename table statement", zap.Any("DDL", tableDef.Query))
 	}
 	oldTable := renameStmt.TableToTables[0].OldTable
+	schemaName := tableDef.Schema
 	if oldTable.Schema.O != "" {
 		schemaName = oldTable.Schema.O
 	}
-	tableName = oldTable.Name.O
+	tableName := oldTable.Name.O
 	return commonType.QuoteSchema(schemaName, tableName), true
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/storage-consumer/consumer.go` around lines 564 - 579, The code handling
RENAME TABLE uses parser.New().ParseOneStmt and extracts oldTable :=
renameStmt.TableToTables[0].OldTable but currently leaves schemaName empty when
oldTable.Schema.O == "", which breaks DDL watermark keys; modify the logic
around oldTable.Schema.O to set schemaName = tableDef.Schema when
oldTable.Schema.O is empty (otherwise keep oldTable.Schema.O), so that the value
passed into commonType.QuoteSchema(schemaName, tableName) correctly falls back
to the current tableDef.Schema for unqualified RENAMEs.
🧹 Nitpick comments (2)
tests/integration_tests/many_pk_or_uk/main.go (1)

111-112: ⚡ Quick win

Leftover c := c is also redundant under Go 1.22+ and inconsistent with the copyloopvar cleanup.

This PR removes pkOrUK := pkOrUK to satisfy copyloopvar, but the sibling reassignment c := c on Line 112 is the same anti-pattern and should be removed for the same reason (each iteration already gets fresh loop variables in Go 1.22+). Leaving one and not the other is inconsistent with the PR's stated goal and may still be flagged by copyloopvar depending on configuration.

♻️ Proposed fix
 		for j, pkOrUK := range []string{"UNIQUE NOT NULL", "PRIMARY KEY"} {
 			g.Add(1)
 			tableName := fmt.Sprintf("pk_or_uk_%d_%d", i, j)
-
-			c := c
 			go func() {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/integration_tests/many_pk_or_uk/main.go` around lines 111 - 112, Remove
the redundant loop-local reassignment "c := c" (the same anti-pattern already
fixed for "pkOrUK := pkOrUK") so the loop relies on Go 1.22+'s fresh iteration
variables; locate the loop that contains the "c := c" statement (and the
previously removed "pkOrUK := pkOrUK") and simply delete the "c := c" line to
avoid the copyloopvar warning and keep the code consistent.
pkg/security/scram_client.go (1)

40-40: 💤 Low value

Consider reverting to explicit embedded field access for clarity.

These changes rely on Go's method promotion from embedded fields (x.NewClient(...)x.HashGeneratorFcn.NewClient(...) and x.NewConversation()x.Client.NewConversation()). While technically correct, the changes:

  1. Are not mentioned in the PR description (don't match copyloopvar, misspell, nosprintfhostport, ineffassign, nilerr, or durationcheck)
  2. Reduce code clarity by making it less obvious which embedded field's method is being invoked
  3. Make the code slightly more fragile to future library changes

The explicit form is more maintainable and self-documenting.

Revert to explicit form
-	x.Client, err = x.NewClient(userName, password, authzID)
+	x.Client, err = x.HashGeneratorFcn.NewClient(userName, password, authzID)
 	if err != nil {
 		return err
 	}
-	x.ClientConversation = x.NewConversation()
+	x.ClientConversation = x.Client.NewConversation()
 	return nil

Also applies to: 44-44

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/security/scram_client.go` at line 40, The review recommends reverting to
explicit embedded field access to improve clarity: replace implicit promoted
calls like x.NewClient(userName, password, authzID) and x.NewConversation() with
the explicit receiver field calls x.HashGeneratorFcn.NewClient(userName,
password, authzID) and x.Client.NewConversation() respectively so it's clear
which embedded type's method is invoked; update occurrences in scram_client.go
(e.g., where x.NewClient and x.NewConversation are used) to call the embedded
field methods directly and run tests/build to ensure no breakage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/oauth2-server/main.go`:
- Around line 155-156: The response status is being set after writing the body;
in the handler that calls fmt.Fprintf(w, openIDConfiguration, serverConfig.port,
serverConfig.port, serverConfig.port) move the call to
w.WriteHeader(http.StatusOK) so it executes before the fmt.Fprintf, and replace
the literal 200 with the http.StatusOK constant to ensure the status is sent
correctly; update the block that references fmt.Fprintf and w.WriteHeader
accordingly.

In `@maintainer/barrier.go`:
- Line 470: The log field name is inconsistent: change the zap.Uint64("commits",
be.commitTs) call to use "commitTs" to match other entries; locate the
zap.Uint64 invocation that references be.commitTs (in barrier.go) and replace
the first argument "commits" with "commitTs" so logging keys are consistent
across functions using be.commitTs.

---

Outside diff comments:
In `@cmd/storage-consumer/consumer.go`:
- Around line 564-579: The code handling RENAME TABLE uses
parser.New().ParseOneStmt and extracts oldTable :=
renameStmt.TableToTables[0].OldTable but currently leaves schemaName empty when
oldTable.Schema.O == "", which breaks DDL watermark keys; modify the logic
around oldTable.Schema.O to set schemaName = tableDef.Schema when
oldTable.Schema.O is empty (otherwise keep oldTable.Schema.O), so that the value
passed into commonType.QuoteSchema(schemaName, tableName) correctly falls back
to the current tableDef.Schema for unqualified RENAMEs.

---

Nitpick comments:
In `@pkg/security/scram_client.go`:
- Line 40: The review recommends reverting to explicit embedded field access to
improve clarity: replace implicit promoted calls like x.NewClient(userName,
password, authzID) and x.NewConversation() with the explicit receiver field
calls x.HashGeneratorFcn.NewClient(userName, password, authzID) and
x.Client.NewConversation() respectively so it's clear which embedded type's
method is invoked; update occurrences in scram_client.go (e.g., where
x.NewClient and x.NewConversation are used) to call the embedded field methods
directly and run tests/build to ensure no breakage.

In `@tests/integration_tests/many_pk_or_uk/main.go`:
- Around line 111-112: Remove the redundant loop-local reassignment "c := c"
(the same anti-pattern already fixed for "pkOrUK := pkOrUK") so the loop relies
on Go 1.22+'s fresh iteration variables; locate the loop that contains the "c :=
c" statement (and the previously removed "pkOrUK := pkOrUK") and simply delete
the "c := c" line to avoid the copyloopvar warning and keep the code consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c80aa2fb-a37b-4ab7-8330-21add2204e0f

📥 Commits

Reviewing files that changed from the base of the PR and between 5521ba3 and 1ce250a.

📒 Files selected for processing (78)
  • cmd/kafka-consumer/writer.go
  • cmd/oauth2-server/main.go
  • cmd/pulsar-consumer/consumer.go
  • cmd/storage-consumer/consumer.go
  • coordinator/changefeed/backoff_test.go
  • coordinator/changefeed/etcd_backend_test.go
  • coordinator/controller.go
  • downstreamadapter/dispatcher/basic_dispatcher.go
  • downstreamadapter/dispatcher/event_dispatcher.go
  • downstreamadapter/dispatchermanager/dispatcher_manager.go
  • downstreamadapter/dispatchermanager/dispatcher_manager_helper.go
  • downstreamadapter/eventcollector/dispatcher_stat_test.go
  • downstreamadapter/routing/ddl_query_rewriter_test.go
  • downstreamadapter/routing/router_apply_test.go
  • downstreamadapter/routing/router_supported_ddl_test.go
  • downstreamadapter/sink/redo/meta.go
  • downstreamadapter/syncpoint/sync_point.go
  • logservice/eventstore/event_store.go
  • logservice/schemastore/schema_store_test.go
  • maintainer/barrier.go
  • maintainer/operator/operator_merge.go
  • maintainer/operator/operator_split.go
  • maintainer/range_checker/table_span_range_checker.go
  • maintainer/replica/split_span_checker.go
  • maintainer/scheduler/balance_splits.go
  • maintainer/scheduler/drain_test.go
  • pkg/applier/redo.go
  • pkg/binlog-filter/filter_test.go
  • pkg/common/event/drop_event.go
  • pkg/common/format.go
  • pkg/common/format_test.go
  • pkg/common/helper_test.go
  • pkg/common/span_op.go
  • pkg/common/table_info.go
  • pkg/common/table_info_helper.go
  • pkg/common/table_info_shared_schema_guard_test.go
  • pkg/common/table_info_test.go
  • pkg/common/table_name_test.go
  • pkg/config/sink.go
  • pkg/diff/checkpoint.go
  • pkg/diff/diff.go
  • pkg/diff/util.go
  • pkg/etcd/client.go
  • pkg/eventservice/event_broker.go
  • pkg/eventservice/event_service_test.go
  • pkg/eventservice/scan_window.go
  • pkg/messaging/message.go
  • pkg/messaging/remote_target.go
  • pkg/notify/notify_test.go
  • pkg/orchestrator/batch_test.go
  • pkg/pdutil/api_client_test.go
  • pkg/redo/reader/reader_test.go
  • pkg/redo/writer/file/file.go
  • pkg/scheduler/replica/replication.go
  • pkg/security/sasl_test.go
  • pkg/security/scram_client.go
  • pkg/sink/codec/common/config.go
  • pkg/sink/codec/csv/csv_message.go
  • pkg/sink/codec/csv/csv_message_test.go
  • pkg/sink/kafka/sarama_config_test.go
  • pkg/sink/mysql/mysql_writer_ddl.go
  • pkg/sink/mysql/mysql_writer_dml_test.go
  • pkg/sink/mysql/mysql_writer_for_syncpoint.go
  • pkg/sink/mysql/mysql_writer_test.go
  • pkg/sink/mysql/sql_builder.go
  • pkg/upstream/upstream.go
  • pkg/version/check_test.go
  • pkg/workerpool/pool_test.go
  • server/server.go
  • tests/integration_tests/api_v2/cases.go
  • tests/integration_tests/cdc/dailytest/case.go
  • tests/integration_tests/cdc/dailytest/parser.go
  • tests/integration_tests/default_value/main.go
  • tests/integration_tests/many_pk_or_uk/main.go
  • tests/integration_tests/multi_source/main.go
  • tests/integration_tests/util/config.go
  • utils/chann/unlimited_chann.go
  • utils/threadpool/thread_pool_test.go
💤 Files with no reviewable changes (1)
  • pkg/common/event/drop_event.go

Comment thread cmd/oauth2-server/main.go Outdated
Comment thread maintainer/barrier.go Outdated
@3AceShowHand
Copy link
Copy Markdown
Collaborator Author

/check-issue-triage-complete

@3AceShowHand
Copy link
Copy Markdown
Collaborator Author

/test all

!(offset > p.watermarkOffset) is equivalent to offset <= p.watermarkOffset
but the latter is cleaner and satisfies staticcheck QF1001.
The ineffassign linter flagged tableName := tableDef.Table because it is
always overwritten before use. schemaName := tableDef.Schema must be kept
as the default value — it is only conditionally overwritten.

Instead of removing both initial values, only drop the dead tableName
assignment and keep schemaName intact.
@3AceShowHand
Copy link
Copy Markdown
Collaborator Author

/test all

Comment thread pkg/sink/mysql/mysql_writer_ddl.go
Comment thread pkg/redo/writer/file/file.go
@3AceShowHand
Copy link
Copy Markdown
Collaborator Author

/test all

@3AceShowHand
Copy link
Copy Markdown
Collaborator Author

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lint: fix golangci-lint auto-fixable issues and selected bugs

1 participant