Skip to content

golangci-lint v2#144

Merged
jy-tan merged 7 commits intoUse-Tusk:mainfrom
dtomasi:golangci-lint-v2
Apr 27, 2026
Merged

golangci-lint v2#144
jy-tan merged 7 commits intoUse-Tusk:mainfrom
dtomasi:golangci-lint-v2

Conversation

@dtomasi
Copy link
Copy Markdown
Contributor

@dtomasi dtomasi commented Apr 27, 2026

Fix golangci-lint tooling versioning and v2 compliance

As you requested in our discussion, I've separated out the golangci-lint updates. During testing, I found the linting setup was broken in multiple ways.

What was wrong

The Makefile said v1, shell.nix had v2, .golangci.yml was written for v1, and things just wouldn't install properly. Different versions in local dev vs CI made things unreproducible.

What I fixed

  • Picked v2.11.4 as our version and updated all configs to match
  • Made Makefile the single source of truth for tool versions
  • Rewrote .golangci.yml for v2 format
  • Applied the v2 compliance fixes (import formatting, error message casing, security annotations)
  • Fixed a boolean logic issue the linter flagged

Now everything builds consistently and linting works consistently across environments. All tests pass and there are no functional changes to the actual application code.

dtomasi and others added 5 commits April 27, 2026 08:36
During testing, we found the linting setup was broken in multiple ways.
The Makefile said v1, shell.nix had v2, .golangci.yml was written for v1,
and things just wouldn't install properly.

This commit fixes all of that by picking v2.11.4 as our version, updating
all configs to match, and making Makefile the single source of truth.

Problems we found:
- Makefile documented v1 but was trying to use v2 import path
- shell.nix installed v2, conflicting with Makefile's old command
- .golangci.yml was v1 syntax, incompatible with v2
- Different versions in local dev vs CI made things unreproducible

What we fixed:
- Pinned golangci-lint to v2.11.4 in Makefile
- Rewrote .golangci.yml for v2 format
- Removed tools from shell.nix (rely on Makefile instead)
- Updated GitHub Actions to use make install-lint-tools

Signed-off-by: Dominik Tomasi <dominik.tomasi@gmail.com>
Now that the linter is working, v2 has stricter rules than v1.
This commit applies those rules across the codebase.

Main changes:
- Add #nosec annotations where we've validated inputs (network ops, file I/O)
- Fix import formatting (blank lines between stdlib and internal imports)
- Lowercase some error message strings for consistency

This is all mechanical/policy stuff - no logic changes.

Signed-off-by: Dominik Tomasi <dominik.tomasi@gmail.com>
Linting changes in d9f9122 broke cd command detection logic.
Commands like 'cd ../repo' were incorrectly rejected.
Targets that don't produce files with their name should be declared
as .PHONY to prevent make from skipping them if files with those
names exist.
Simplifies the boolean condition in isPureCDCommand to address
golangci-lint v2 staticcheck QF1001 suggestion.
@dtomasi dtomasi requested a review from jy-tan as a code owner April 27, 2026 07:12
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 18 files

@dtomasi dtomasi mentioned this pull request Apr 27, 2026
Copy link
Copy Markdown
Contributor

@jy-tan jy-tan left a comment

Choose a reason for hiding this comment

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

Can you fix the Linux lint errors too, thank you!

Linux-specific gosec G115, G704, staticcheck ST1005, and gofumpt issues
were invisible to darwin users. Updated Makefile lint-all target to catch
cross-platform issues during development.

Fixed remaining linux related linting errors.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 7 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Makefile">

<violation number="1" location="Makefile:88">
P1: `lint-all` can hide failing lint runs because all platforms are executed in one semicolon-chained shell command, so an early failure can be overwritten by a later success.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread Makefile Outdated
adds set -e; to loop in makefile

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@jy-tan jy-tan merged commit b187926 into Use-Tusk:main Apr 27, 2026
6 checks passed
@dtomasi dtomasi deleted the golangci-lint-v2 branch April 27, 2026 21:45
@jy-tan jy-tan mentioned this pull request Apr 28, 2026
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