Skip to content

chore: separate go lint scripts#3933

Open
GAlexIHU wants to merge 1 commit intomainfrom
chore/go-lint-speed
Open

chore: separate go lint scripts#3933
GAlexIHU wants to merge 1 commit intomainfrom
chore/go-lint-speed

Conversation

@GAlexIHU
Copy link
Contributor

@GAlexIHU GAlexIHU commented Mar 10, 2026

Overview

TLDR: does less, works faster, should be enough for local checks

make lint-go (no cache)

INFO Execution took 3m53.407050875s
Executing target: lint-go
golangci-lint run -v
INFO golangci-lint has version 2.8.0 built with go1.25.5 from v2.8.0 on 1970-01-01T00:00:00Z
INFO [config_reader] Config search paths: [./ /Users/alexgoth/code/om/openmeter /Users/alexgoth/code/om /Users/alexgoth/code /Users/alexgoth /Users /]
INFO [config_reader] Used config file .golangci.yaml
INFO [config_reader] Module name "github.com/openmeterio/openmeter"
INFO maxprocs: Leaving GOMAXPROCS=16: CPU quota undefined
INFO [goenv] Read go env for 5.287959ms: map[string]string{"GOCACHE":"/Users/alexgoth/Library/Caches/go-build", "GOROOT":"/nix/store/fy2aq0rg6vbiyjfdpqy3429hqsan7iwm-go-1.25.5/share/go/"}
INFO [lintersdb] Active 14 linters: [bodyclose errcheck gci gofmt gofumpt goimports govet ineffassign misspell nolintlint sloglint staticcheck unconvert whitespace]
INFO [loader] Go packages loading at mode 8767 (compiled_files|deps|exports_file|files|imports|types_sizes|name) took 2.783189s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 213.055ms
INFO [linters_context/goanalysis] analyzers took 1h9m58.265250639s with top 10 stages: buildir: 19m20.99374583s, goimports: 5m39.761635467s, unconvert: 1m33.527946341s, gci: 1m27.020807366s, whitespace: 1m14.161846124s, gofumpt: 1m14.024665411s, buildssa: 1m8.717548155s, gofmt: 54.528190655s, S1038: 48.160710086s, misspell: 46.589375251s
INFO [runner/exclusion_paths] Skipped 0 issues by pattern ".dagger/internal"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern ".dagger/dagger.gen.go"
INFO [runner/exclusion_paths] Skipped 4 issues by pattern "collector/benthos/internal"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "third_party$"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "builtin$"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "examples$"
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: ".dagger/internal", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: ".dagger/dagger.gen.go", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: "collector/benthos/internal", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: "third_party$", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: "builtin$", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: "examples$", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner] Issues before processing: 5033, after processing: 0
INFO [runner] Processors filtering stat (in/out): path_absoluter: 5033/5033, cgo: 5033/5033, generated_file_filter: 5029/1576, path_relativity: 5033/5033, filename_unadjuster: 5033/5033, invalid_issue: 5033/5033, exclusion_rules: 1576/25, nolint_filter: 25/0, exclusion_paths: 5033/5029
INFO [runner] processing took 116.624671ms with stages: generated_file_filter: 106.26825ms, exclusion_paths: 4.754167ms, path_relativity: 2.866999ms, exclusion_rules: 1.993834ms, nolint_filter: 439.833µs, invalid_issue: 120.041µs, cgo: 107.792µs, path_absoluter: 52.875µs, filename_unadjuster: 16.917µs, sort_results: 2.084µs, max_same_issues: 876ns, fixer: 250ns, uniq_by_line: 209ns, path_prettifier: 209ns, max_from_linter: 126ns, source_code: 84ns, path_shortener: 83ns, severity-rules: 42ns, max_per_file_from_linter: 0s, diff: 0s
INFO [runner] linters took 3m50.396631125s with stages: goanalysis_metalinter: 3m50.2798895s
0 issues.
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 2226 samples, avg is 9523.0MB, max is 10327.0MB
INFO Execution took 3m53.407050875s




openmeter git:(feat/ledger-charges) ✗ golangci-lint cache status
Dir: /Users/alexgoth/Library/Caches/golangci-lint
Size: 10.9MiB

make lint-go (fresh cache)

INFO Execution took 5.087436208s
Executing target: lint-go
golangci-lint run -v
INFO golangci-lint has version 2.8.0 built with go1.25.5 from v2.8.0 on 1970-01-01T00:00:00Z
INFO [config_reader] Config search paths: [./ /Users/alexgoth/code/om/openmeter /Users/alexgoth/code/om /Users/alexgoth/code /Users/alexgoth /Users /]
INFO [config_reader] Used config file .golangci.yaml
INFO [config_reader] Module name "github.com/openmeterio/openmeter"
INFO maxprocs: Leaving GOMAXPROCS=16: CPU quota undefined
INFO [goenv] Read go env for 4.969875ms: map[string]string{"GOCACHE":"/Users/alexgoth/Library/Caches/go-build", "GOROOT":"/nix/store/fy2aq0rg6vbiyjfdpqy3429hqsan7iwm-go-1.25.5/share/go/"}
INFO [lintersdb] Active 14 linters: [bodyclose errcheck gci gofmt gofumpt goimports govet ineffassign misspell nolintlint sloglint staticcheck unconvert whitespace]
INFO [loader] Go packages loading at mode 8767 (exports_file|files|name|compiled_files|imports|types_sizes|deps) took 2.8011395s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 218.651333ms
INFO [linters_context/goanalysis] analyzers took 0s with no stages
INFO [runner/exclusion_paths] Skipped 4 issues by pattern "collector/benthos/internal"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "third_party$"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "builtin$"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "examples$"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern ".dagger/internal"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern ".dagger/dagger.gen.go"
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: "collector/benthos/internal", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: "third_party$", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: "builtin$", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: "examples$", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: ".dagger/internal", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner/exclusion_rules] Skipped 0 issues by rules: [Path: ".dagger/dagger.gen.go", Linters: "gci, gofmt, gofumpt, goimports"]
INFO [runner] Issues before processing: 5033, after processing: 0
INFO [runner] Processors filtering stat (in/out): cgo: 5033/5033, invalid_issue: 5033/5033, filename_unadjuster: 5033/5033, path_relativity: 5033/5033, generated_file_filter: 5029/1576, exclusion_rules: 1576/25, path_absoluter: 5033/5033, exclusion_paths: 5033/5029, nolint_filter: 25/0
INFO [runner] processing took 35.605998ms with stages: generated_file_filter: 26.352666ms, exclusion_paths: 4.740167ms, path_relativity: 1.943833ms, exclusion_rules: 1.939458ms, nolint_filter: 318µs, cgo: 130.917µs, invalid_issue: 118.041µs, path_absoluter: 48.124µs, filename_unadjuster: 12.042µs, sort_results: 917ns, max_same_issues: 791ns, fixer: 208ns, path_prettifier: 167ns, source_code: 126ns, max_from_linter: 125ns, path_shortener: 125ns, diff: 84ns, max_per_file_from_linter: 83ns, uniq_by_line: 82ns, severity-rules: 42ns
INFO [runner] linters took 2.054253583s with stages: goanalysis_metalinter: 2.018583708s
0 issues.
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 52 samples, avg is 100.2MB, max is 172.1MB
INFO Execution took 5.087436208s

make lint-go-fast (no cache)

INFO Execution took 52.045313s
➜  openmeter git:(feat/ledger-charges) ✗ make lint-go-fast
Executing target: lint-go-fast
golangci-lint run -v --config .golangci-fast.yaml ./...
INFO golangci-lint has version 2.8.0 built with go1.25.5 from v2.8.0 on 1970-01-01T00:00:00Z
INFO [config_reader] Used config file .golangci-fast.yaml
INFO [config_reader] Module name "github.com/openmeterio/openmeter"
INFO maxprocs: Leaving GOMAXPROCS=16: CPU quota undefined
INFO [goenv] Read go env for 6.32975ms: map[string]string{"GOCACHE":"/Users/alexgoth/Library/Caches/go-build", "GOROOT":"/nix/store/fy2aq0rg6vbiyjfdpqy3429hqsan7iwm-go-1.25.5/share/go/"}
INFO [lintersdb] Active 10 linters: [bodyclose errcheck govet ineffassign misspell nolintlint sloglint staticcheck unconvert whitespace]
INFO [loader] Go packages loading at mode 8767 (deps|name|compiled_files|exports_file|files|imports|types_sizes) took 3.084485708s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 223.111541ms
INFO [linters_context/goanalysis] analyzers took 10m12.772623213s with top 10 stages: buildir: 4m36.098688434s, whitespace: 40.481026348s, unconvert: 12.384675828s, printf: 11.011178714s, nilness: 7.901659134s, ctrlflow: 6.391934231s, inspect: 6.379496491s, misspell: 6.279142469s, fact_purity: 6.100478451s, S1038: 5.727208424s
INFO [runner/exclusion_paths] Skipped 4 issues by pattern "collector/benthos/internal"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "third_party$"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "builtin$"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "examples$"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern ".dagger/internal"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern ".dagger/dagger.gen.go"
INFO [runner] Issues before processing: 3338, after processing: 0
INFO [runner] Processors filtering stat (in/out): filename_unadjuster: 3338/3338, path_relativity: 3338/3338, nolint_filter: 25/0, path_absoluter: 3338/3338, exclusion_paths: 3338/3334, generated_file_filter: 3334/1576, exclusion_rules: 1576/25, cgo: 3338/3338, invalid_issue: 3338/3338
INFO [runner] processing took 59.339249ms with stages: generated_file_filter: 54.201125ms, exclusion_paths: 2.975084ms, path_relativity: 1.302917ms, exclusion_rules: 383.708µs, nolint_filter: 287.792µs, cgo: 74.333µs, invalid_issue: 71.625µs, path_absoluter: 31.666µs, filename_unadjuster: 8.375µs, max_same_issues: 833ns, sort_results: 791ns, path_prettifier: 209ns, fixer: 167ns, path_shortener: 125ns, source_code: 124ns, uniq_by_line: 124ns, max_per_file_from_linter: 84ns, diff: 84ns, max_from_linter: 83ns, severity-rules: 0s
INFO [runner] linters took 48.729609958s with stages: goanalysis_metalinter: 48.670219167s
0 issues.
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 502 samples, avg is 8547.4MB, max is 11111.9MB
INFO Execution took 52.045313s

make lint-go-fast (fresh cache)

INFO Execution took 5.377096875s
➜  openmeter git:(feat/ledger-charges) ✗ make lint-go-fast
Executing target: lint-go-fast
golangci-lint run -v --config .golangci-fast.yaml ./...
INFO golangci-lint has version 2.8.0 built with go1.25.5 from v2.8.0 on 1970-01-01T00:00:00Z
INFO [config_reader] Used config file .golangci-fast.yaml
INFO [config_reader] Module name "github.com/openmeterio/openmeter"
INFO maxprocs: Leaving GOMAXPROCS=16: CPU quota undefined
INFO [goenv] Read go env for 5.622542ms: map[string]string{"GOCACHE":"/Users/alexgoth/Library/Caches/go-build", "GOROOT":"/nix/store/fy2aq0rg6vbiyjfdpqy3429hqsan7iwm-go-1.25.5/share/go/"}
INFO [lintersdb] Active 10 linters: [bodyclose errcheck govet ineffassign misspell nolintlint sloglint staticcheck unconvert whitespace]
INFO [loader] Go packages loading at mode 8767 (deps|exports_file|imports|name|types_sizes|compiled_files|files) took 2.901527333s
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 221.473333ms
INFO [linters_context/goanalysis] analyzers took 0s with no stages
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "examples$"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern ".dagger/internal"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern ".dagger/dagger.gen.go"
INFO [runner/exclusion_paths] Skipped 4 issues by pattern "collector/benthos/internal"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "third_party$"
INFO [runner/exclusion_paths] Skipped 0 issues by pattern "builtin$"
INFO [runner] Issues before processing: 3338, after processing: 0
INFO [runner] Processors filtering stat (in/out): path_absoluter: 3338/3338, exclusion_paths: 3338/3334, nolint_filter: 25/0, filename_unadjuster: 3338/3338, cgo: 3338/3338, invalid_issue: 3338/3338, path_relativity: 3338/3338, generated_file_filter: 3334/1576, exclusion_rules: 1576/25
INFO [runner] processing took 32.306841ms with stages: generated_file_filter: 26.965417ms, exclusion_paths: 3.0635ms, path_relativity: 1.336042ms, exclusion_rules: 435.293µs, nolint_filter: 311.667µs, invalid_issue: 77.833µs, cgo: 77.75µs, path_absoluter: 24.959µs, filename_unadjuster: 7.958µs, sort_results: 4.167µs, max_same_issues: 959ns, fixer: 251ns, path_prettifier: 209ns, diff: 167ns, source_code: 167ns, max_from_linter: 126ns, path_shortener: 125ns, max_per_file_from_linter: 125ns, uniq_by_line: 84ns, severity-rules: 42ns
INFO [runner] linters took 2.246753791s with stages: goanalysis_metalinter: 2.214407167s
0 issues.
INFO File cache stats: 0 entries of total size 0B
INFO Memory: 55 samples, avg is 100.2MB, max is 168.6MB
INFO Execution took 5.377096875s

Summary by CodeRabbit

  • Chores
    • Established a new optimized linting configuration with carefully curated linter rules, comprehensive exclusion patterns, and enhanced per-linter settings for thorough code quality verification.
    • Expanded development tooling infrastructure with flexible linting command options, including dedicated fast linting and style-checking capabilities for more granular and efficient code quality workflows.

@GAlexIHU GAlexIHU requested a review from a team as a code owner March 10, 2026 14:19
@GAlexIHU GAlexIHU added the release-note/misc Miscellaneous changes label Mar 10, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

📝 Walkthrough

Walkthrough

Introduces GolangCI-Lint configuration for faster linting and updates the Makefile to support granular linting workflows with a configurable path variable and new linting targets.

Changes

Cohort / File(s) Summary
Linting Configuration
.golangci-fast.yaml
New GolangCI-Lint configuration file defining curated linter settings, including enabled linters (bodyclose, errcheck, govet, etc.), per-linter configurations, and exclusion patterns for generated code and internal paths.
Build Infrastructure
Makefile
Added GO_LINT_PATH variable for flexible path configuration and created two new linting targets: lint-go-fast for fast linting and lint-go-style for formatting checks, replacing hardcoded lint commands with variable-driven invocations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 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 'chore: separate go lint scripts' directly and clearly summarizes the main change—introducing separated Go linting scripts and configurations for faster local workflows.
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 unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/go-lint-speed

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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
Contributor

@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 (1)
Makefile (1)

9-9: Keep lint-go pinned to the full repo.

Now that Line 191 honors GO_LINT_PATH, make lint and make ci can silently skip packages whenever that variable is set in the caller’s environment. I’d keep lint-go hardcoded to ./... and reserve GO_LINT_PATH for the new local-only lint-go-fast / lint-go-style targets.

Suggested tweak
 .PHONY: lint-go
 lint-go: ## Lint Go code
 	$(call print-target)
-	golangci-lint run -v $(GO_LINT_PATH)
+	golangci-lint run -v ./...

Also applies to: 188-201

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` at line 9, The lint target currently uses GO_LINT_PATH which allows
callers to skip packages; change the lint-go target to hardcode the full repo
path ./... (keep GO_LINT_PATH defined for other targets) so lint-go always runs
across the repo, and update lint-go-fast and lint-go-style to reference
GO_LINT_PATH for local-only scans; adjust target definitions (lint-go,
lint-go-fast, lint-go-style) accordingly so GO_LINT_PATH is reserved for
fast/style targets while lint-go uses ./....
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.golangci-fast.yaml:
- Around line 3-44: The fast profile currently enables the same linters as the
full profile; update the linters.enable list (the "linters.enable" block) to a
smaller subset (e.g., keep only fast-running checks like govet, errcheck,
ineffassign, whitespace, misspell) and reduce the staticcheck scope in the
"staticcheck.checks" list (remove "all" and explicitly include only selected
checks or prefix with "-" to disable heavy checks) so lint-go-fast actually runs
fewer checks; also consider trimming exclusions.paths or presets only if needed
to avoid duplicating the main config while ensuring the fast profile is a
lighter, faster subset of the full profile.

---

Nitpick comments:
In `@Makefile`:
- Line 9: The lint target currently uses GO_LINT_PATH which allows callers to
skip packages; change the lint-go target to hardcode the full repo path ./...
(keep GO_LINT_PATH defined for other targets) so lint-go always runs across the
repo, and update lint-go-fast and lint-go-style to reference GO_LINT_PATH for
local-only scans; adjust target definitions (lint-go, lint-go-fast,
lint-go-style) accordingly so GO_LINT_PATH is reserved for fast/style targets
while lint-go uses ./....

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b9afd901-aab7-4069-b67b-74839818a2fe

📥 Commits

Reviewing files that changed from the base of the PR and between faa6568 and afe13b1.

📒 Files selected for processing (2)
  • .golangci-fast.yaml
  • Makefile

Comment on lines +3 to +44
linters:
default: none
enable:
- bodyclose
- errcheck
- govet
- ineffassign
- misspell
- nolintlint
- sloglint
- staticcheck
- unconvert
- whitespace
settings:
misspell:
locale: US
nolintlint:
require-specific: true
revive:
confidence: 0
staticcheck:
checks:
- "all"
- "-QF1008"
- "-SA1019" # https://staticcheck.dev/docs/checks/#SA1019
# FIXME: re-enable the following checks
- "-ST1003"
- "-ST1016"
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- .dagger/internal
- .dagger/dagger.gen.go
- collector/benthos/internal
- third_party$
- builtin$
- examples$
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

This “fast” profile currently matches the full lint profile.

Lines 3-44 are the same as .golangci.yaml:1-45, so lint-go-fast doesn’t actually slim down the lint surface here; it mostly introduces a second config to keep in sync. If the goal is a lighter local pass, this file needs a smaller enabled linter set and/or a reduced staticcheck scope.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.golangci-fast.yaml around lines 3 - 44, The fast profile currently enables
the same linters as the full profile; update the linters.enable list (the
"linters.enable" block) to a smaller subset (e.g., keep only fast-running checks
like govet, errcheck, ineffassign, whitespace, misspell) and reduce the
staticcheck scope in the "staticcheck.checks" list (remove "all" and explicitly
include only selected checks or prefix with "-" to disable heavy checks) so
lint-go-fast actually runs fewer checks; also consider trimming exclusions.paths
or presets only if needed to avoid duplicating the main config while ensuring
the fast profile is a lighter, faster subset of the full profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/misc Miscellaneous changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant