main fd2f58a

#132 chore(lint): triage the 71 golangci-lint warnings (errcheck, staticcheck)

state
resolved
opened
bnema ·
resolved by
!134
updated

golangci-lint run ./... (v2.15.0, default linters, no .golangci.yml) reports 71 issues on fix/v0.15-review (92e19fcb). go vet, staticcheck ./... (standalone) and make check pass; golangci-lint is not part of make check or CI.

None of these were linked to a concrete bug during the v0.15.0 release review. They need a triage pass, not a blind fix.

errcheck (50)

Almost all are unchecked Close calls on cleanup paths.

Production code (20):

File Calls
internal/adapters/drm/frame_submit.go 7 × pdone/xdone/done.Close
internal/adapters/fdwait/poller.go 3 × p.file/p.wake.Close
internal/adapters/outputkit/routing/leases.go 3 × (*os.File).Close
internal/adapters/logging/logging.go 2 × lifecycle.Close, f.Close (session lock files)
internal/adapters/drm/card.go, cursor_images.go, frame_lifecycle.go, supervisor/supervisor.go 1 each (Close)
examples/testime/main.go 1 × c.Close

Tests (30): mostly fdwait, drm, routing, logging, powerkey, core tests.

staticcheck (21)

Check Count Meaning
QF1008 9 Embedded field selector can be omitted
QF1003 5 Use a tagged switch instead of an if/else chain
QF1001 3 Apply De Morgan's law
QF1002 2 Use a tagged switch on a value
ST1023 2 Omit the redundant type in a declaration

Spread over internal/core (x11active, workspace_operations, spawn_placement, separators, sdr_expansion, some tests), internal/adapters/wayland (clipboard, colormanagement, activation, xwm/mapflow), drm/supervisor and outputkit/routing.

Proposed approach

  1. errcheck, production: decide per call. A Close on a read-only fd or a cleanup after another error is fine to ignore: make it explicit with _ = (or a shared helper). A Close that can lose data or hides a sync/fence failure (frame_submit.go, leases.go) should be checked or at least logged with a component field.
  2. errcheck, tests: check the error, or ignore it explicitly.
  3. staticcheck QF/ST: apply where it makes the code clearer. These are quick fixes, not bugs.
  4. Add a .golangci.yml with the agreed linters, and a lint target in make check plus CI, so new warnings do not pile up again.

Reproduce

golangci-lint run ./...

Comments0

  1. bnema referenced this in !133 fix: resolve v0.15.0 release review findings ·

no comments yet.

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. On pages with a side panel: into the panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit; in a file, click a line number to select it, shift-click for a range
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 33

Tags 15

↑↓ moveenter openesc close