Skip to content

chore(lint): update linter configuration and workflow#166

Merged
flc1125 merged 3 commits intov2.xfrom
build
Nov 11, 2025
Merged

chore(lint): update linter configuration and workflow#166
flc1125 merged 3 commits intov2.xfrom
build

Conversation

@flc1125
Copy link
Copy Markdown
Owner

@flc1125 flc1125 commented Nov 11, 2025

Summary by CodeRabbit

Release Notes

  • Chores
    • Enhanced code quality processes with updated linting rules and stricter code analysis checks
    • Optimized build pipeline with improved caching and dependency management
    • Updated Go version handling and streamlined build workflow

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Nov 11, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 11, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR updates the project's CI/CD infrastructure and development tooling by upgrading the Go version to stable, enhancing linting configuration with additional linters and rules, refactoring the Makefile with consolidated tool commands and new workflow targets, formalizing golangci-lint as a tool dependency, and configuring dependency grouping through Renovate.

Changes

Cohort / File(s) Summary
CI/CD Workflow
.github/workflows/lint.yml
Updated Go version from 1.24.x to stable; added caching for Go modules and GolangCI-Lint; introduced lint and check-clean-work workflow steps
Linting Configuration
.golangci.yml
Added misspell, gocritic, and usetesting linters; expanded revive rules with context-as-argument and additional rule set; removed lll linter; adjusted formatters by removing gofmt rewrite rules
Build Automation
Makefile
Introduced GO and GOLANGCI_LINT variables; replaced init workflow with go-mod-tidy; repurposed lint target with multi-step process; added lint-fix and check-clean-work targets; removed formatting (fmt, fumpt) and nilaway targets
Dependency Management
go.mod, renovate.json
Added tool directive for golangci-lint; expanded require block with numerous indirect dependencies for Go tooling and linters; downgraded golang.org/x/sys to v0.37.0; configured Renovate to group golang.org/x/** dependencies

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • .github/workflows/lint.yml: Verify Go version compatibility and cache key strategy for CI performance
  • .golangci.yml: Review new linter rules and revive configurations for alignment with project standards
  • Makefile: Audit new lint workflow logic, go-mod-tidy compatibility flag (1.24.0), and clean-work enforcement
  • go.mod: Validate new indirect dependencies introduced by golangci-lint tooling; confirm golang.org/x/sys downgrade rationale

Possibly related PRs

Suggested labels

dependencies, go, size:M

Poem

🐰 A rabbit hops through CI with glee,
Stable Go versions, as they should be!
New linters guard the burrow with care,
Makefile refactored, workflows laid bare,
Dependencies grouped, the toolchain's complete—
This DevOps carrot, oh what a treat! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main changes: updating linter configuration (.golangci.yml) and lint workflow (.github/workflows/lint.yml), which are the primary modifications across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch build

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.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @flc1125, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on modernizing and refining the project's linting and build processes. It introduces stricter code quality checks by integrating new linters and updating existing rules, while simultaneously simplifying the Makefile for more efficient and consistent development workflows. The changes also include explicit declaration of golangci-lint as a Go tool and improved dependency grouping for golang.org/x packages, contributing to a more robust and maintainable codebase.

Highlights

  • Linter Configuration Update: Added new linters such as misspell, gocritic, and usetesting to enhance code quality checks. The lll (line length) linter was removed. Numerous revive rules were also introduced or refined, focusing on context-as-argument, error handling, and variable naming conventions.
  • Makefile Simplification and Refactoring: The Makefile has been significantly streamlined. Redundant targets for installing tools (init), specific formatting (fmt, fumpt), and nilaway have been removed. The lint target now explicitly uses go tool golangci-lint and includes a go-mod-tidy prerequisite, along with new concurrency settings. A check-clean-work target was added to ensure a clean working tree.
  • Go Module Tool Declaration: The go.mod file now explicitly declares golangci-lint as a Go tool dependency, aligning with the updated Makefile's approach to invoking the linter.
  • Renovate Configuration Enhancement: A new rule has been added to renovate.json to group updates for golang.org/x packages, improving dependency management and reducing noise from related updates.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/lint.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.60%. Comparing base (3dae9d4) to head (e0fba2b).
⚠️ Report is 1 commits behind head on v2.x.

Additional details and impacted files
@@           Coverage Diff           @@
##             v2.x     #166   +/-   ##
=======================================
  Coverage   94.60%   94.60%           
=======================================
  Files           1        1           
  Lines         278      278           
=======================================
  Hits          263      263           
  Misses         13       13           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@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 updates the linter configuration and related workflows. The changes in .golangci.yml introduce more static analysis checks which is great for code quality. Pinning golangci-lint in go.mod and using it via go tool is a good practice for reproducible builds. The renovate.json change to group golang.org/x dependencies is also a nice improvement to reduce PR noise. I've left one suggestion on the Makefile to improve the clarity and user experience of the lint and lint-fix targets. Overall, these are solid improvements to the project's tooling.

Comment on lines +9 to 15
.PHONY: lint
lint: go-mod-tidy
@echo "Starting linting..." && \
$(GOLANGCI_LINT) run --concurrency=4 --allow-serial-runners $(ARGS)
lint-fix: ARGS=--fix
lint-fix: lint
@echo "✅ Lint fixing completed"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The current implementation of lint and lint-fix is a bit confusing. When running make lint-fix, the output is "Starting linting..." which is not entirely accurate. Also, the lint target is missing a completion message.

To improve clarity and user experience, I suggest making these targets more explicit, even if it introduces a small amount of duplication. Readability is often more important than being DRY in Makefiles.

.PHONY: lint lint-fix
lint: go-mod-tidy
	@echo "Starting linting..." && \
		$(GOLANGCI_LINT) run --concurrency=4 --allow-serial-runners
	@echo "✅ Linting completed"

lint-fix: go-mod-tidy
	@echo "Starting lint fixing..." && \
		$(GOLANGCI_LINT) run --concurrency=4 --allow-serial-runners --fix
	@echo "✅ Lint fixing completed"

Copy link
Copy Markdown

@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: 0

🧹 Nitpick comments (1)
Makefile (1)

9-12: Lint target missing completion message.

The lint target (which can be run directly via make lint) displays "Starting linting..." but lacks a completion message. When lint is invoked independently, users see no indication that it finished successfully. The lint-fix target inherits this behavior and adds its own completion message (line 15), but lint itself should also signal completion for better user feedback.

Apply this diff to add a completion message to the lint target:

 .PHONY: lint
 lint: go-mod-tidy
 	@echo "Starting linting..." && \
 		$(GOLANGCI_LINT) run --concurrency=4 --allow-serial-runners $(ARGS)
+	@echo "✅ Linting completed"

 lint-fix: ARGS=--fix
 lint-fix: lint

This ensures both make lint and make lint-fix provide clear feedback to users.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3dae9d4 and e0fba2b.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • .github/workflows/lint.yml (1 hunks)
  • .golangci.yml (1 hunks)
  • Makefile (1 hunks)
  • go.mod (1 hunks)
  • renovate.json (1 hunks)
🧰 Additional context used
🪛 checkmake (0.2.2)
Makefile

[warning] 22-22: Missing required phony target "all"

(minphony)


[warning] 22-22: Missing required phony target "clean"

(minphony)

🔇 Additional comments (12)
renovate.json (1)

18-21: Clean addition of golang.org/x dependency grouping.

The new Renovate rule properly groups golang.org/x modules, which aligns with the expanded tooling dependencies in go.mod and improves dependency management clarity.

go.mod (2)

5-5: Tool directive formalizes golangci-lint dependency.

Adding golangci-lint/v2 as a tool dependency ensures consistent tooling versions across development and CI environments, supporting the workflow changes in this PR.


14-223: Extensive tooling dependencies support enhanced linting configuration.

The large set of added indirect dependencies (linters, analyzers, formatters, and supporting libraries) aligns with the expanded linter rules in .golangci.yml and enables the comprehensive linting workflow.

.github/workflows/lint.yml (3)

19-19: Verify workflow reproducibility with "stable" Go version.

Using stable instead of a pinned Go version (e.g., 1.24) means CI will automatically use newer Go releases. While this keeps tooling current, it can introduce subtle inconsistencies if breaking changes occur. Consider pinning to a major version if reproducibility across time is important.

Is the use of "stable" Go version intentional, or should this be pinned to 1.24 to match go.mod and the Makefile compat flag?


21-35: Cache configuration is well-structured.

The separate caching for Go modules and golangci-lint, with proper key derivation and restore fallbacks, follows GitHub Actions best practices and should improve workflow performance significantly.


37-41: Workflow steps correctly delegate to Makefile targets.

The new lint and check-clean-work steps properly invoke the corresponding Makefile targets, enabling centralized tool management and consistent local/CI behavior.

.golangci.yml (4)

15-15: Added linters enhance code quality coverage.

The inclusion of misspell, gocritic, and usetesting expands the linting surface to catch common mistakes (typos, code smells, incorrect testing patterns), complementing existing linters.

Also applies to: 17-17, 26-26


29-50: Well-documented revive rules with targeted context handling.

The expanded revive rule set, including context-as-argument with testing-type allowlist and targeted rules (time-equal, use-any, waitgroup-by-value), demonstrates thoughtful linting configuration. The documentation link on line 29 aids maintainability.


48-50: Usetesting configuration properly encourages testing best practices.

The context-background and context-todo flags help developers use appropriate context patterns in tests, improving test robustness.


52-55: Formatter configuration modernization.

Keeping gofumpt and goimports while removing gofmt aligns with Go ecosystem evolution and simplifies the formatter toolchain.

Makefile (2)

22-30: Check-clean-work target enforces repository state consistency.

The new check-clean-work target ensures that uncommitted changes are caught in CI, encouraging developers to commit or stash changes before pushing. The informative error messages and git status output aid debugging.


1-7: Tool variables and go-mod-tidy target improve maintainability.

Centralizing GO and GOLANGCI_LINT invocations into variables and creating a dedicated go-mod-tidy target with version compatibility flag simplifies future updates and ensures consistent tooling usage across all targets.

@flc1125 flc1125 merged commit 2a22342 into v2.x Nov 11, 2025
12 checks passed
@flc1125 flc1125 deleted the build branch November 11, 2025 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant