detached d2ca9d3

docs(examples): checked README sketch and staticcheck in examples-check

commit
d2ca9d37403b133b08f6698bc232b2cb18564a5e
author
brice · · 2026-10-01 19:23 UTC
parent
53d2224
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +17 -7
M Makefile +1 -1
@@ -21,6 +21,6 @@ fakes-check:
2121 perf-check:
2222 CGO_ENABLED=0 go test -run 'TestAlloc' -count=1 ./...
2323 examples-check:
24- cd examples && CGO_ENABLED=0 go build ./... && CGO_ENABLED=0 go vet ./...
24+ cd examples && CGO_ENABLED=0 go build ./... && CGO_ENABLED=0 go vet ./... && CGO_ENABLED=0 staticcheck ./...
2525 check: build clean-build vet test fakes-check perf-check
2626 CGO_ENABLED=0 staticcheck ./...
@@ -21,6 +21,6 @@ fakes-check:
21 perf-check:21 perf-check:
22 CGO_ENABLED=0 go test -run 'TestAlloc' -count=1 ./...22 CGO_ENABLED=0 go test -run 'TestAlloc' -count=1 ./...
23 examples-check:23 examples-check:
24- cd examples && CGO_ENABLED=0 go build ./... && CGO_ENABLED=0 go vet ./...24+ cd examples && CGO_ENABLED=0 go build ./... && CGO_ENABLED=0 go vet ./... && CGO_ENABLED=0 staticcheck ./...
25 check: build clean-build vet test fakes-check perf-check25 check: build clean-build vet test fakes-check perf-check
26 CGO_ENABLED=0 staticcheck ./...26 CGO_ENABLED=0 staticcheck ./...
M README.md +16 -6
@@ -16,22 +16,32 @@ A Wayland client toolkit library for Go: connection, outputs, surface roles, sea
1616 The library does not render. The `examples` module pairs it with [NeferGUI](https://github.com/bnema/nefergui) (a pure graphics library with no Wayland code); the two never import each other, and the examples copy plain fields between them. The loop runs on one owner goroutine:
1717
1818 ```go
19-conn, _ := neferclient.Connect(ctx, "")
20-surf, _ := conn.NewLayerSurface(neferclient.LayerConfig{Level: neferclient.LayerTop, Width: 240, Height: 90})
19+conn, err := neferclient.Connect(ctx, "")
20+if err != nil {
21+ return fmt.Errorf("connect: %w", err)
22+}
23+defer conn.Close()
24+surf, err := conn.NewLayerSurface(neferclient.LayerConfig{Level: neferclient.LayerTop, Width: 240, Height: 90})
25+if err != nil {
26+ return fmt.Errorf("layer surface: %w", err)
27+}
2128 for {
2229 select {
2330 case <-conn.Wake():
24- conn.Dispatch(handler) // Configure, FeedbackDone, Frame, Pointer, Key, FDReady...
31+ if err := conn.Dispatch(handler); err != nil { // Configure, FeedbackDone, Frame, Pointer, Key, FDReady...
32+ return fmt.Errorf("dispatch: %w", err)
33+ }
34+ case <-ctx.Done():
35+ return nil
2536 }
26- // render with NeferGUI, then:
27- // surf.ImportBuffer / surf.ImportTimeline / surf.Present
37+ // render with NeferGUI, then surf.ImportBuffer / surf.ImportTimeline / surf.Present
2838 }
2939 ```
3040
3141 - [`examples/layer`](examples/layer): a layer surface with a counter button.
3242 - [`examples/lock`](examples/lock): a session lock with a masked password field. It is a demo and authenticates nothing; read its header before running it.
3343
34-Run them against a compositor with `cd examples && go run ./layer`. `make examples-check` builds and vets them; the headless test needs a NeferWL binary: `NEFERCLIENT_HEADLESS=/usr/sbin/neferwl go test ./... -run Headless`.
44+Run them against a compositor with `cd examples && go run ./layer`. `make examples-check` builds, vets and lints them; the headless test needs a NeferWL binary: `cd examples && NEFERCLIENT_HEADLESS=/usr/sbin/neferwl go test -run Headless ./...`.
3545
3646 ## License
3747
@@ -16,22 +16,32 @@ A Wayland client toolkit library for Go: connection, outputs, surface roles, sea
16 The library does not render. The `examples` module pairs it with [NeferGUI](https://github.com/bnema/nefergui) (a pure graphics library with no Wayland code); the two never import each other, and the examples copy plain fields between them. The loop runs on one owner goroutine:16 The library does not render. The `examples` module pairs it with [NeferGUI](https://github.com/bnema/nefergui) (a pure graphics library with no Wayland code); the two never import each other, and the examples copy plain fields between them. The loop runs on one owner goroutine:
17 17
18 ```go18 ```go
19-conn, _ := neferclient.Connect(ctx, "")19+conn, err := neferclient.Connect(ctx, "")
20-surf, _ := conn.NewLayerSurface(neferclient.LayerConfig{Level: neferclient.LayerTop, Width: 240, Height: 90})20+if err != nil {
21+ return fmt.Errorf("connect: %w", err)
22+}
23+defer conn.Close()
24+surf, err := conn.NewLayerSurface(neferclient.LayerConfig{Level: neferclient.LayerTop, Width: 240, Height: 90})
25+if err != nil {
26+ return fmt.Errorf("layer surface: %w", err)
27+}
21 for {28 for {
22 select {29 select {
23 case <-conn.Wake():30 case <-conn.Wake():
24- conn.Dispatch(handler) // Configure, FeedbackDone, Frame, Pointer, Key, FDReady...31+ if err := conn.Dispatch(handler); err != nil { // Configure, FeedbackDone, Frame, Pointer, Key, FDReady...
32+ return fmt.Errorf("dispatch: %w", err)
33+ }
34+ case <-ctx.Done():
35+ return nil
25 }36 }
26- // render with NeferGUI, then:37+ // render with NeferGUI, then surf.ImportBuffer / surf.ImportTimeline / surf.Present
27- // surf.ImportBuffer / surf.ImportTimeline / surf.Present
28 }38 }
29 ```39 ```
30 40
31 - [`examples/layer`](examples/layer): a layer surface with a counter button.41 - [`examples/layer`](examples/layer): a layer surface with a counter button.
32 - [`examples/lock`](examples/lock): a session lock with a masked password field. It is a demo and authenticates nothing; read its header before running it.42 - [`examples/lock`](examples/lock): a session lock with a masked password field. It is a demo and authenticates nothing; read its header before running it.
33 43
34-Run them against a compositor with `cd examples && go run ./layer`. `make examples-check` builds and vets them; the headless test needs a NeferWL binary: `NEFERCLIENT_HEADLESS=/usr/sbin/neferwl go test ./... -run Headless`.44+Run them against a compositor with `cd examples && go run ./layer`. `make examples-check` builds, vets and lints them; the headless test needs a NeferWL binary: `cd examples && NEFERCLIENT_HEADLESS=/usr/sbin/neferwl go test -run Headless ./...`.
35 45
36 ## License46 ## License
37 47

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. Elsewhere: into the side 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
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 1

Tags 4

↑↓ moveenter openesc close