Conversation
arosh
reviewed
Mar 17, 2026
arosh
reviewed
Mar 17, 2026
arosh
reviewed
Mar 17, 2026
arosh
reviewed
Mar 17, 2026
arosh
reviewed
Mar 17, 2026
arosh
reviewed
Mar 17, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces golangci-lint as the unified Go linting tool (installed via Aqua and run in CI) and applies repo-wide code updates to satisfy the newly enabled linters.
Changes:
- Add
golangci-lint(Aqua + config) and wire it into CI viamake lint. - Refactor codebase to address lints/modernization (e.g.,
any,rangeover ints,*Seqstring helpers, explicit error discards, reduced cyclomatic warnings). - Simplify some controller helper signatures and remove now-unnecessary request plumbing.
Reviewed changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/event/event.go | Modernize variadic type from interface{} to any. |
| pkg/dbop/test_util.go | Use strings.FieldsSeq iteration for cleanup loop. |
| pkg/dbop/replication.go | Switch-based version selection for replication command. |
| pkg/dbop/operator.go | Add //nolint:nilerr for intentional nil-error return. |
| pkg/dbop/gtid.go | Modernize slice loop using range. |
| pkg/dbop/driver.go | Modernize logger signature; explicitly ignore SetLogger return. |
| pkg/bucket/s3_test.go | Modernize integer loop using range over int. |
| pkg/bucket/gcs_test.go | Modernize integer loop using range over int. |
| pkg/bucket/azure_test.go | Modernize integer loop using range over int. |
| pkg/bkop/status.go | Switch-based version handling for status query differences. |
| pkg/bkop/restore.go | Make ignored Close calls explicit for errcheck. |
| pkg/bkop/operator.go | Explicitly ignore DB close error. |
| e2e/run_test.go | Use promoted pvc.Labels field. |
| e2e/prevent_delete_test.go | Modernize integer loops using range over int. |
| e2e/failure_test.go | Use WaitGroup.Go pattern to reduce goroutine boilerplate. |
| controllers/suite_test.go | Modernize channel element type to any. |
| controllers/pvc_test.go | Update tests for new reconcilePVC/needResizePVC signatures. |
| controllers/pvc.go | Simplify reconcilePVC API; embed-client calls; remove unused error path. |
| controllers/partition_controller.go | Use embedded client methods (List, Patch). |
| controllers/mysqlcluster_controller.go | Use maps.Copy; simplify reconcile helpers’ signatures; add nolint:gocyclo; minor time comparison update. |
| controllers/mysql_container.go | Use max for probe threshold; remove now-unneeded loopvar copies. |
| controllers/certificate.go | Simplify helpers’ signatures; use embedded client methods (Get, Create). |
| cmd/moco-backup/cmd/root.go | Return os.Setenv error instead of ignoring. |
| cmd/moco-backup/cmd/restore.go | Modernize retry loop using range over int. |
| cmd/kubectl-moco/cmd/mysql.go | Drop unused context parameter in getPodName call. |
| cmd/kubectl-moco/cmd/common.go | Simplify getPodName signature (remove unused ctx). |
| clustering/status_test.go | Remove loopvar copy now unnecessary with modern Go. |
| clustering/status.go | Ignore close errors; add nolint:gocyclo; use strings.SplitSeq. |
| clustering/operations.go | Explicitly ignore close errors; modernize loops; make named returns explicit. |
| clustering/mock_test.go | Use strings.SplitSeq in GTID parsing helpers. |
| clustering/metrics_test.go | Modernize matcher method signatures to any. |
| clustering/manager_test.go | Modernize integer loops; update Eventually return types to any. |
| clustering/manager.go | Use WaitGroup.Go pattern for process goroutine. |
| backup/restore.go | Modernize loops; explicitly ignore cleanup/close errors. |
| backup/integration_test.go | Modernize integer loop using range over int. |
| backup/bytecounter_test.go | Remove redundant cast in byte-count assertion. |
| backup/backup.go | Explicitly ignore cleanup/close errors; minor type simplification. |
| aqua.yaml | Add golangci/golangci-lint to Aqua-managed tools. |
| aqua-checksums.json | Add checksums for golangci-lint artifacts. |
| api/v1beta2/statefulset_webhhok.go | Use promoted APIVersion field. |
| api/v1beta2/mysqlcluster_types.go | Add nolint annotations; fix spelling; modernize switch style. |
| api/v1beta2/backuppolicy_types.go | Add nolint:unparam for validation helper. |
| Makefile | Add lint target; remove direct staticcheck/nilerr tool install; adjust test target. |
| .golangci.yml | New golangci-lint v2 config enabling selected linters/formatters. |
| .github/workflows/ci.yaml | Run make lint in CI before make test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
331
to
335
| for _, tt := range tests { | ||
| tt := tt | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| r := &MySQLClusterReconciler{} | ||
| resizeTarget, resize, err := r.needResizePVC(tt.cluster, tt.sts) | ||
| if tt.wantError != nil { | ||
| if !errors.Is(err, tt.wantError) { | ||
| t.Fatalf("want error %v, got %v", tt.wantError, err) | ||
| } | ||
| } | ||
|
|
||
| resizeTarget, resize := r.needResizePVC(tt.cluster, tt.sts) | ||
| if tt.wantResize != resize { |
arosh
reviewed
Mar 25, 2026
| } | ||
| } | ||
| return | ||
| return redo, e |
Member
There was a problem hiding this comment.
戻り値が (redo bool, e error) になっているものの、実際には e に何か値を設定している箇所は無いようです。 return redo, e は return redo, nil に置き換えられそうです。
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
lrf141
approved these changes
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.