Skip to content

Update golangci-lint to v2.11#1657

Merged
meiji163 merged 13 commits intomasterfrom
meiji163-update-golangci
May 1, 2026
Merged

Update golangci-lint to v2.11#1657
meiji163 merged 13 commits intomasterfrom
meiji163-update-golangci

Conversation

@meiji163
Copy link
Copy Markdown
Contributor

@meiji163 meiji163 commented Apr 7, 2026

Upgrade golangci-lint to v2.11 since the current version won't work with go1.25 (#1668). This requires a lot of trivial changes to satisfy the linters. No logic is changed in this PR.

In case this PR introduced Go code changes:

  • contributed code is using same conventions as original code
  • script/cibuild returns with no formatting errors, build errors or unit test errors.

@meiji163 meiji163 changed the title Update golangci-lint version to v1.64.8 Update golangci-lint version to v2.11 May 1, 2026
@meiji163 meiji163 changed the title Update golangci-lint version to v2.11 Update golangci-lint to v2.11 May 1, 2026
@meiji163 meiji163 marked this pull request as ready for review May 1, 2026 01:25
Copilot AI review requested due to automatic review settings May 1, 2026 01:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Upgrades the repository’s GolangCI-Lint tooling to v2.11 (needed for Go 1.25 compatibility) and applies the associated repo-wide lint-driven refactors/expectation updates without intended behavioral changes.

Changes:

  • Update GolangCI-Lint CI workflow to use golangci/golangci-lint-action@v9 with v2.11, and migrate .golangci.yml to the v2 config format.
  • Apply widespread Go lint cleanups (receiver renames away from this, minor simplifications, and error-string casing/format changes).
  • Update local test expect_failure golden outputs to match updated error/log formatting.
Show a summary per file
File Description
localtests/trigger-ghost-name-conflict/expect_failure Update expected failure output formatting/casing.
localtests/modify-change-case-pk/expect_failure Update expected failure output formatting/casing.
localtests/fail-rename-table/expect_failure Update expected failure output formatting/casing.
localtests/fail-no-unique-key/expect_failure Update expected failure output formatting/casing.
localtests/fail-no-shared-uk/expect_failure Update expected failure output formatting/casing.
localtests/fail-float-unique-key/expect_failure Update expected failure output formatting/casing.
localtests/fail-existing-datetime-with-zero/expect_failure Update expected failure output (now includes full fatal MySQL error text).
localtests/fail-drop-pk/expect_failure Update expected failure output formatting/casing.
localtests/datetime-to-timestamp-pk-fail/expect_failure Update expected failure output formatting/casing.
go/sql/types.go Receiver renames; column/column-list helpers; introduces/keeps a broken ColumnList.Equals implementation.
go/sql/parser.go Receiver renames for AlterTableParser methods.
go/sql/builder_test.go Use strings.ReplaceAll in query normalization helper.
go/sql/builder.go Error string casing changes; minor simplification.
go/mysql/utils.go Receiver rename; error string casing changes.
go/mysql/instance_key_map.go Receiver renames for InstanceKeyMap methods.
go/mysql/instance_key.go IPv6 host:port regex tweak; receiver renames; error string casing changes.
go/mysql/connection.go Receiver renames for ConnectionConfig; minor formatting/casing changes.
go/mysql/binlog_gtid.go Receiver renames for GTID coordinate methods.
go/mysql/binlog_file.go Receiver renames; error string casing changes.
go/logic/throttler.go Receiver renames; small readability refactor while preserving behavior.
go/logic/streamer_test.go Cleanup import aliasing for sql.NullString; remove nolint comment.
go/logic/streamer.go Receiver renames; error string casing changes.
go/logic/server.go Receiver renames; user-facing message tweaks (one loses trailing newline).
go/logic/migrator_test.go Remove nolint comments; adjust test code formatting.
go/logic/inspect.go Receiver renames; error string casing changes (one message now has a typo: “Isp scenario…”).
go/logic/hooks.go Receiver renames for HooksExecutor.
go/logic/applier_test.go Update expected error string; remove nolint comments.
go/binlog/gomysql_reader.go Receiver renames; slight loop restructuring in StreamEvents.
go/binlog/binlog_entry.go Receiver rename for String().
go/binlog/binlog_dml_event.go Receiver rename for String().
go/base/utils.go Error string casing changes.
go/base/load_map.go Receiver renames for LoadMap.
go/base/context.go Receiver renames across MigrationContext methods; minor string helper changes.
.golangci.yml Migrate to golangci-lint v2 config; adjust enabled/disabled linters/formatters; remove prior run timeout.
.github/workflows/golangci-lint.yml Use golangci-lint-action@v9 with golangci-lint v2.11.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (2)

go/sql/builder.go:212

  • BuildRangeComparison returns errors that mention GetEqualsComparison, which is misleading (and doesn't match the Build* naming used here). Updating these messages will make it much easier to understand failures in range comparison construction.
func BuildRangeComparison(columns []string, values []string, args []interface{}, comparisonSign ValueComparisonSign) (result string, explodedArgs []interface{}, err error) {
	if len(columns) == 0 {
		return "", explodedArgs, fmt.Errorf("got 0 columns in GetRangeComparison")
	}
	if len(columns) != len(values) {
		return "", explodedArgs, fmt.Errorf("got %d columns but %d values in GetEqualsComparison", len(columns), len(values))
	}
	if len(columns) != len(args) {
		return "", explodedArgs, fmt.Errorf("got %d columns but %d args in GetEqualsComparison", len(columns), len(args))
	}

.golangci.yml:6

  • The previous run.timeout: 5m setting was removed. Since the workflow does not pass an explicit --timeout and larger repos can exceed golangci-lint's default, consider restoring an explicit timeout (either in .golangci.yml under run: or via the GitHub Action config) to avoid flaky CI timeouts.
version: "2"
linters:
  enable:
    - bodyclose
    - containedctx
    - contextcheck
  • Files reviewed: 36/37 changed files
  • Comments generated: 5

Comment thread .golangci.yml
Comment thread go/sql/types.go
func (this *ColumnList) Equals(other *ColumnList) bool {
return reflect.DeepEqual(this.Columns, other.Columns)
func (cl *ColumnList) Equals(other *ColumnList) bool {
return reflect.DeepEqual(cl.Columns, other.Columns)
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

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

ColumnList.Equals is comparing the Columns method values (cl.Columns / other.Columns) instead of the underlying slices, so it will always return false (functions are only DeepEqual when both are nil). It should compare cl.columns/other.columns (or cl.Columns()/other.Columns()), and ideally handle other == nil to avoid panics if added later.

Suggested change
return reflect.DeepEqual(cl.Columns, other.Columns)
if cl == other {
return true
}
if cl == nil || other == nil {
return false
}
return reflect.DeepEqual(cl.columns, other.columns)

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

out of scope, I don't want to change any logic

Comment thread go/logic/inspect.go Outdated
Comment thread go/sql/builder.go
Comment thread go/logic/server.go Outdated
@meiji163 meiji163 merged commit 4d37b8a into master May 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants