Skip to content

fix(linter): Make make lint run and pass again - #1202

Merged
cmainas merged 4 commits into
urunc-dev:main-pr1202from
martijnhoekstra:fix/make-lint
Nov 16, 2026
Merged

cmainas merged 4 commits into
urunc-dev:main-pr1202from
martijnhoekstra:fix/make-lint

Conversation

@martijnhoekstra

@martijnhoekstra martijnhoekstra commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

make lint pins golangci-lint v2.9, which can't load a go1.27.3 module, so it stops before linting. The lint workflow moved to v2.15 with the Go v1.27.2 update in ee1476e; the Makefile stayed behind. With v2.15, six findings show up that CI doesn't report because of only-new-issues. This PR updates the Makefile and fixes or annotates those findings, one commit each:

  1. The Makefile's golangci-lint goes to v2.15, as in the lint workflow.
  2. dupl: the hvt and spt BuildExecCmd bodies were identical; both now call one solo5ExecCmd, which also holds the separator const. dupl skips hvt.go and spt.go, which are now the same thin wrapper.
  3. gosec G115 in getUnprivilegedMountFlags: the ST_* flags are compared as int64, the type of Statfs_t.Flags on amd64 and arm64, instead of converting the flags to uintptr.
  4. gosec G702 and G703 in cmd/urunc/utils.go are annotated as false positives: runcExec hands non-unikernel containers to runc with urunc's own arguments, and prepareXDGRuntimeDir only creates $XDG_RUNTIME_DIR/urunc for a rootless user.

Related issues

How was this tested?

  • golangci-lint v2.15 with make lint's command (golangci-lint run -v --timeout=5m) reports 0 issues.
  • All unit test targets pass (test_unikontainers as a non-root user).
  • go build ./... passes for amd64; pkg/unikontainers also builds and vets for arm64.
  • The ctr e2e suite with urunc built by make static and Firecracker v1.7.0: all 14 specs the test machine can run pass, including the four hvt and spt Mirage specs. Skipped because the machine lacks devmapper, virtiofsd and Hyperlight: the two rumprun specs, Qemu-linux-read-file-virtiofs and Hyperlight-unikraft-hello.

LLM usage

Claude Opus 5.5 (claude-opus-5-5) helped write the changes and this description, and ran the tests above. I reviewed the changes and the results.

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

@netlify

netlify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

👷 Deploy request for urunc pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 642bac1

@martijnhoekstra
martijnhoekstra marked this pull request as ready for review November 11, 2026 08:40
The lint workflow moved to golangci-lint v2.15 with the Go v1.27.2
update in ee1476e, but the Makefile stayed at v2.9, which can't load a
go1.27.3 module, so make lint stopped before linting.

Fixes: urunc-dev#1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>

@cmainas cmainas left a comment

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.

Thank you @martijnhoekstra for the PR.

A couple generic comments:

Other than that PR looks good, just a nit for a constant. Please let me know your opinion for the OpenRoot change.

Comment thread pkg/unikontainers/hypervisors/hvt.go Outdated

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.

Since, we perform this change. Can we also move this const in the solo5.go file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, but it triggers a new dupl linter warning, and wants to unify hvt and spt for solo5 into a solo5 tender if we do.

I'd suggest moving and suppressing on the file(s), or keeping it where it's now, but not merging hvt and spt into a single tender. What's your pref?

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.

Eventually, we should merge hvt/spt. Let's go with your suggestion. I will also open an issue to merge them in a follow up.

@martijnhoekstra

Copy link
Copy Markdown
Contributor Author

For the openRoot, it's a question of whether we add the lint suppression or do what it wants despite questionable usefulness. IMO doing what it wants is at worst harmless, and lint suppression is the more dangerous route, but it's definitely questionable, which is why I already left it as a separate commit. If we drop 5e4a334 we get the suppression back. I don't really have a strong pref

Let me know your preference, and either I'll add the tests to the makefile when the openRoot stays, or I'll remove them altogether when it goes.

The hvt and spt tenders take the same command line, and their
BuildExecCmd bodies were identical, which dupl reported. Build it in one
solo5ExecCmd. What is left of hvt.go and spt.go is the same thin wrapper,
so dupl skips those two files.

Fixes: urunc-dev#1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
Statfs_t.Flags is an int64 on amd64 and arm64, and the ST_* constants
are untyped, so keep them as int64 instead of converting the flags to
uintptr, which gosec reported as G115.

Fixes: urunc-dev#1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
runcExec hands non-unikernel containers to runc with urunc's own
arguments, and prepareXDGRuntimeDir only creates $XDG_RUNTIME_DIR/urunc
for a rootless user, so G702 and G703 do not apply there.

Fixes: urunc-dev#1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
@cmainas

cmainas commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

I agree that suppressions should be avoided and always justified. However, the changes in prepareXDGRuntimeDir do not have any actual benefit, since the function returns the path as a string and everything after should resolve the path again. Therefore, it is like trying to satisfy the linter with a change that works like a suppression, but hidden. For this particular case, let's go with an explicit visible suppression with the justification,

@martijnhoekstra
martijnhoekstra force-pushed the fix/make-lint branch 2 times, most recently from 3805f23 to 642bac1 Compare November 16, 2026 13:59
@urunc-bot
urunc-bot Bot changed the base branch from main to main-pr1202 November 16, 2026 15:31

@cmainas cmainas left a comment

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.

Thank you @martijnhoekstra for the fix.

@cmainas
cmainas merged commit b7907d6 into urunc-dev:main-pr1202 Nov 16, 2026
40 of 41 checks passed
github-actions Bot pushed a commit that referenced this pull request Nov 16, 2026
The lint workflow moved to golangci-lint v2.15 with the Go v1.27.2
update in ee1476e, but the Makefile stayed at v2.9, which can't load a
go1.27.3 module, so make lint stopped before linting.

PR: #1202
Fixes: #1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
github-actions Bot pushed a commit that referenced this pull request Nov 16, 2026
The hvt and spt tenders take the same command line, and their
BuildExecCmd bodies were identical, which dupl reported. Build it in one
solo5ExecCmd. What is left of hvt.go and spt.go is the same thin wrapper,
so dupl skips those two files.

PR: #1202
Fixes: #1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
github-actions Bot pushed a commit that referenced this pull request Nov 16, 2026
Statfs_t.Flags is an int64 on amd64 and arm64, and the ST_* constants
are untyped, so keep them as int64 instead of converting the flags to
uintptr, which gosec reported as G115.

PR: #1202
Fixes: #1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
github-actions Bot pushed a commit that referenced this pull request Nov 16, 2026
runcExec hands non-unikernel containers to runc with urunc's own
arguments, and prepareXDGRuntimeDir only creates $XDG_RUNTIME_DIR/urunc
for a rootless user, so G702 and G703 do not apply there.

PR: #1202
Fixes: #1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
urunc-bot Bot pushed a commit that referenced this pull request Nov 16, 2026
The lint workflow moved to golangci-lint v2.15 with the Go v1.27.2
update in ee1476e, but the Makefile stayed at v2.9, which can't load a
go1.27.3 module, so make lint stopped before linting.

PR: #1202
Fixes: #1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
urunc-bot Bot pushed a commit that referenced this pull request Nov 16, 2026
The hvt and spt tenders take the same command line, and their
BuildExecCmd bodies were identical, which dupl reported. Build it in one
solo5ExecCmd. What is left of hvt.go and spt.go is the same thin wrapper,
so dupl skips those two files.

PR: #1202
Fixes: #1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
urunc-bot Bot pushed a commit that referenced this pull request Nov 16, 2026
Statfs_t.Flags is an int64 on amd64 and arm64, and the ST_* constants
are untyped, so keep them as int64 instead of converting the flags to
uintptr, which gosec reported as G115.

PR: #1202
Fixes: #1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
urunc-bot Bot pushed a commit that referenced this pull request Nov 16, 2026
runcExec hands non-unikernel containers to runc with urunc's own
arguments, and prepareXDGRuntimeDir only creates $XDG_RUNTIME_DIR/urunc
for a rootless user, so G702 and G703 do not apply there.

PR: #1202
Fixes: #1201
Signed-off-by: Martijn <martijn.hoekstra@kiteworks.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make lint fails locally

2 participants