Skip to content

chore: add CI linting, sync deps, fix lint issues#13

Merged
ankurs merged 4 commits intomainfrom
chore/update-03-2026
Mar 21, 2026
Merged

chore: add CI linting, sync deps, fix lint issues#13
ankurs merged 4 commits intomainfrom
chore/update-03-2026

Conversation

@ankurs
Copy link
Member

@ankurs ankurs commented Mar 21, 2026

Summary

  • Update options dependency v0.2.3 to v0.2.4
  • Fix unchecked lgr.Log() errors in gokit logger
  • Add golangci-lint config and CI lint job
  • Standardize CI with separate build/test/lint jobs

Test plan

  • make build passes
  • make test passes (with -race)
  • make lint passes with 0 issues

Summary by CodeRabbit

Release Notes

  • Chores

    • Enhanced CI/CD pipeline with explicit permissions and separated build, test, and lint jobs.
    • Added linting configuration to enforce code quality standards.
    • Updated Go module dependency.
  • New Features

    • Added lint and bench targets to build commands for local development.

- Update options dependency v0.2.3 to v0.2.4
- Fix unchecked lgr.Log() errors in gokit logger
- Add golangci-lint config and CI lint job
- Standardize CI with separate build/test/lint jobs
@coderabbitai
Copy link

coderabbitai bot commented Mar 21, 2026

📝 Walkthrough

Walkthrough

The pull request introduces CI/build infrastructure improvements including GitHub workflow refactoring with explicit permissions and job separation, adds golangci-lint configuration, extends the Makefile with linting and benchmarking targets, updates a Go module dependency version, and applies explicit error handling in the gokit logger.

Changes

Cohort / File(s) Summary
CI/Build Infrastructure
.github/workflows/go.yml, Makefile
Refactored GitHub Actions workflow into distinct build, test, and lint jobs with pinned action commits; replaced hardcoded Go version with go.mod reference; switched build/test commands to use make targets. Makefile now includes lint and bench targets, updated .PHONY declaration, and reordered test command arguments.
Linting Configuration
.golangci.yml
New golangci-lint v2 configuration with exclusion presets (comments, common-false-positives, legacy, std-error-handling), rule-based exclusions for test files, and path filters for generated code, third-party, builtin, and example directories.
Dependency Management
go.mod
Minor version bump of github.com/go-coldbrew/options from v0.2.3 to v0.2.4.
Code Logic
loggers/gokit/gokit.go
Updated logger.Log method to explicitly assign return values to underscore in both conditional branches for improved code clarity.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 With workflows refined and linters now aligned,
The CI/CD pipeline's redesigned!
Tests and builds now march in unity's dance,
While golangci keeps the code in tune—no chance
For tangled threads; this build's now pristine.

🚥 Pre-merge checks | ✅ 3
✅ 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 summarizes all three main changes: adding CI linting (.golangci.yml and workflow lint job), syncing deps (go.mod version bump), and fixing lint issues (gokit logger errors).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/update-03-2026

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

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

This PR introduces CI linting via golangci-lint, refreshes dependencies, and addresses lint findings in the go-kit logger implementation to standardize the project’s build/test/lint automation.

Changes:

  • Bump github.com/go-coldbrew/options from v0.2.3 to v0.2.4 (and sync go.sum).
  • Add .golangci.yml, a make lint target, and a GitHub Actions lint job.
  • Update go-kit logger usage to satisfy error-checking linters.

Reviewed changes

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

Show a summary per file
File Description
loggers/gokit/gokit.go Adjusts go-kit logger calls to handle/acknowledge Log() return errors.
go.mod Updates the options dependency version.
go.sum Syncs module checksums after dependency changes.
Makefile Adds lint and bench targets; expands .PHONY.
.golangci.yml Adds golangci-lint configuration.
.github/workflows/go.yml Splits CI into separate build/test/lint jobs and wires up golangci-lint.

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

- Add permissions: contents: read to CI workflows
- Fix go test flag order (-race before packages)
- Fix bench target to skip regular tests (-run=^$)
Copy link

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

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.


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

- Pin actions/checkout, actions/setup-go, golangci-lint-action to commit SHAs
- Replace hardcoded go-version with go-version-file: go.mod
Copy link

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

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.


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

- Make lint target reproducible (go install golangci-lint)
- Add missing tests and strengthen assertions
- Fix error string grammar
Copy link

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

🧹 Nitpick comments (2)
loggers/gokit/gokit.go (1)

36-40: Handle lgr.Log errors instead of discarding them.

On Line 37 and Line 39, _ = lgr.Log(...) only suppresses lint and still hides sink failures. Prefer a best-effort fallback path so logging outages are visible.

Proposed diff
 	if len(args) == 1 {
-		_ = lgr.Log("msg", args[0])
+		if err := lgr.Log("msg", args[0]); err != nil {
+			_, _ = fmt.Fprintf(os.Stderr, "gokit logger write failed: %v\n", err)
+		}
 	} else {
-		_ = lgr.Log(args...)
+		if err := lgr.Log(args...); err != nil {
+			_, _ = fmt.Fprintf(os.Stderr, "gokit logger write failed: %v\n", err)
+		}
 	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@loggers/gokit/gokit.go` around lines 36 - 40, The calls to lgr.Log in the
logging helper currently swallow returned errors (`_ = lgr.Log(...)`); change
this to capture the error value from lgr.Log (the calls around the conditional
using lgr.Log and variable lgr) and implement a best-effort fallback when err !=
nil such as writing an error message (including the original log args and the
returned err) to a safe sink (e.g., os.Stderr or the std library logger) so sink
failures are visible; update both branches (the single-arg branch that logs
"msg", args[0] and the variadic branch that forwards args...) to follow this
pattern.
Makefile (1)

13-15: Consider pinning golangci-lint version for reproducibility.

Using @latest works but may cause inconsistent behavior across different developer machines or CI runs over time. Consider pinning to a specific version (e.g., @v2.1.6) that matches or is compatible with the version: v2.8 specified in the GitHub Actions workflow.

♻️ Suggested change
 lint:
-	go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
+	go install github.com/golangci/golangci-lint/cmd/golangci-lint@v2.1.6
 	golangci-lint run
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` around lines 13 - 15, The Makefile's lint target installs
golangci-lint with `@latest` making builds unreproducible; change the install
command in the lint target to pin a specific version (e.g., replace "go install
github.com/golangci/golangci-lint/cmd/golangci-lint@latest" in the lint target
with a fixed tag such as "@v2.8.0" or the version that matches CI) so all
developers and CI use the same golangci-lint binary.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/go.yml:
- Around line 53-57: Update the golangci-lint GitHub Action to a newer release
by changing the action input for the "Lint" step (the step with name "Lint" and
uses: golangci/golangci-lint-action@...) so the version under with: version is
at least v2.11 (e.g., v2.11 or v2.11.3) instead of v2.8; keep the args and
timeout unchanged and ensure the updated version string follows the existing
format used in the workflow.

---

Nitpick comments:
In `@loggers/gokit/gokit.go`:
- Around line 36-40: The calls to lgr.Log in the logging helper currently
swallow returned errors (`_ = lgr.Log(...)`); change this to capture the error
value from lgr.Log (the calls around the conditional using lgr.Log and variable
lgr) and implement a best-effort fallback when err != nil such as writing an
error message (including the original log args and the returned err) to a safe
sink (e.g., os.Stderr or the std library logger) so sink failures are visible;
update both branches (the single-arg branch that logs "msg", args[0] and the
variadic branch that forwards args...) to follow this pattern.

In `@Makefile`:
- Around line 13-15: The Makefile's lint target installs golangci-lint with
`@latest` making builds unreproducible; change the install command in the lint
target to pin a specific version (e.g., replace "go install
github.com/golangci/golangci-lint/cmd/golangci-lint@latest" in the lint target
with a fixed tag such as "@v2.8.0" or the version that matches CI) so all
developers and CI use the same golangci-lint binary.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2da8b129-d6cf-4769-8c96-3ccd36033565

📥 Commits

Reviewing files that changed from the base of the PR and between 14a39c4 and fed4e40.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • .github/workflows/go.yml
  • .golangci.yml
  • Makefile
  • go.mod
  • loggers/gokit/gokit.go

@ankurs ankurs merged commit 83da361 into main Mar 21, 2026
8 checks passed
@ankurs ankurs deleted the chore/update-03-2026 branch March 21, 2026 15:14
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.

2 participants