Skip to content

Introduce golangci lint - #121

Merged
yamatcha merged 5 commits into
mainfrom
introduce-golangci-lint
Sep 15, 2026
Merged

yamatcha merged 5 commits into
mainfrom
introduce-golangci-lint

Conversation

@yamatcha

@yamatcha yamatcha commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR transitions the repository’s Go linting workflow to golangci-lint (installed via aqua), aligning with the approach used by cybozu-go/moco and updating both local make targets and CI accordingly.

Changes:

  • Add golangci-lint to aqua and introduce a .golangci.yml configuration.
  • Replace the old make validate pipeline with make lint (and update CI to use it).
  • Apply code updates required to satisfy the enabled linters (e.g., errcheck-related close/sync calls, any modernization).

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
server/suite_test.go Removes prior custom-checker suppression comment now that linting is unified under golangci-lint.
server/mysqld_health.go Updates error-checking style for rows.Close() (now triggers errcheck considerations).
server/mysqld_health_test.go Modernizes interface{} to any in test code.
server/initialize.go Adjusts db.Close() usage to satisfy errcheck.
server/clone.go Adjusts Close() usage to satisfy errcheck.
Makefile Replaces validate/tool-install targets with a lint target that runs golangci-lint.
cmd/moco-init/main.go Adjusts file close handling to satisfy errcheck.
cmd/moco-agent/cmd/root.go Updates logger interface signature, adds error handling for mysql.SetLogger, and adjusts close/sync defers.
cmd/cp/main.go Adjusts file close handling to satisfy errcheck.
aqua.yaml Adds golangci/golangci-lint@v2.12.2.
aqua-checksums.json Adds checksums for golangci-lint artifacts.
.golangci.yml Adds golangci-lint v2 configuration and formatter settings.
.github/workflows/ci.yaml Updates validation job to run make lint and removes prior tool caching steps.

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

Comment thread cmd/moco-agent/cmd/root.go
Comment thread server/mysqld_health.go Outdated
return
}
rows.Close()
_ = rows.Close()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@yamatcha
We should use GetContext in this situation.
https://jmoiron.github.io/sqlx/#getAndSelect

Handling QueryContext correctly is too difficult for humanity 😅

@yamatcha
yamatcha merged commit e33fdb3 into main Sep 15, 2026
8 checks passed
@yamatcha
yamatcha deleted the introduce-golangci-lint branch September 15, 2026 08:43
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.

4 participants