chore: bootstrap neferclient module
- commit
- ccab19be07886d3705d6d7026b3e34c1f24fc486
- author
- brice · · 2026-10-01 14:57 UTC
- parent
- none (root commit)
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
9 files · +126 -0
A .github/workflows/ci.yml +37 -0
| @@ -0,0 +1,37 @@ | |||
| 1 | + | name: CI | |
| 2 | + | on: | |
| 3 | + | push: | |
| 4 | + | branches: [main] | |
| 5 | + | pull_request: | |
| 6 | + | concurrency: | |
| 7 | + | group: ci-${{ github.ref }} | |
| 8 | + | cancel-in-progress: true | |
| 9 | + | jobs: | |
| 10 | + | # Arch matches the development system: Go and library versions are the | |
| 11 | + | # ones the module is developed against. | |
| 12 | + | check: | |
| 13 | + | runs-on: ubuntu-latest | |
| 14 | + | container: | |
| 15 | + | image: archlinux:latest | |
| 16 | + | options: --init | |
| 17 | + | env: | |
| 18 | + | XDG_RUNTIME_DIR: /tmp/xdg-runtime | |
| 19 | + | steps: | |
| 20 | + | # libxkbcommon is loaded at runtime through purego; tests run without a | |
| 21 | + | # compositor or a GPU. gcc is for the race detector. | |
| 22 | + | - run: >- | |
| 23 | + | pacman -Syu --noconfirm --needed | |
| 24 | + | git go make gcc libxkbcommon | |
| 25 | + | - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| 26 | + | with: | |
| 27 | + | persist-credentials: false | |
| 28 | + | - run: | | |
| 29 | + | git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| 30 | + | install -d -m 700 "$XDG_RUNTIME_DIR" | |
| 31 | + | - run: | | |
| 32 | + | go install github.com/vektra/mockery/v3@v3.8.0 | |
| 33 | + | go install honnef.co/go/tools/cmd/staticcheck@latest | |
| 34 | + | echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" | |
| 35 | + | - run: make check | |
| 36 | + | - run: make race | |
| 37 | + | - run: make mocks-check | |
| @@ -0,0 +1,37 @@ | |||||
| 1 | + | name: CI | |||
| 2 | + | on: | |||
| 3 | + | push: | |||
| 4 | + | branches: [main] | |||
| 5 | + | pull_request: | |||
| 6 | + | concurrency: | |||
| 7 | + | group: ci-${{ github.ref }} | |||
| 8 | + | cancel-in-progress: true | |||
| 9 | + | jobs: | |||
| 10 | + | # Arch matches the development system: Go and library versions are the | |||
| 11 | + | # ones the module is developed against. | |||
| 12 | + | check: | |||
| 13 | + | runs-on: ubuntu-latest | |||
| 14 | + | container: | |||
| 15 | + | image: archlinux:latest | |||
| 16 | + | options: --init | |||
| 17 | + | env: | |||
| 18 | + | XDG_RUNTIME_DIR: /tmp/xdg-runtime | |||
| 19 | + | steps: | |||
| 20 | + | # libxkbcommon is loaded at runtime through purego; tests run without a | |||
| 21 | + | # compositor or a GPU. gcc is for the race detector. | |||
| 22 | + | - run: >- | |||
| 23 | + | pacman -Syu --noconfirm --needed | |||
| 24 | + | git go make gcc libxkbcommon | |||
| 25 | + | - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |||
| 26 | + | with: | |||
| 27 | + | persist-credentials: false | |||
| 28 | + | - run: | | |||
| 29 | + | git config --global --add safe.directory "$GITHUB_WORKSPACE" | |||
| 30 | + | install -d -m 700 "$XDG_RUNTIME_DIR" | |||
| 31 | + | - run: | | |||
| 32 | + | go install github.com/vektra/mockery/v3@v3.8.0 | |||
| 33 | + | go install honnef.co/go/tools/cmd/staticcheck@latest | |||
| 34 | + | echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" | |||
| 35 | + | - run: make check | |||
| 36 | + | - run: make race | |||
| 37 | + | - run: make mocks-check | |||
A .gitignore +5 -0
| @@ -0,0 +1,5 @@ | |||
| 1 | + | /bin/ | |
| 2 | + | /.worktrees/ | |
| 3 | + | go.work | |
| 4 | + | go.work.sum | |
| 5 | + | *.out | |
| @@ -0,0 +1,5 @@ | |||||
| 1 | + | /bin/ | |||
| 2 | + | /.worktrees/ | |||
| 3 | + | go.work | |||
| 4 | + | go.work.sum | |||
| 5 | + | *.out | |||
A .mockery.yml +8 -0
| @@ -0,0 +1,8 @@ | |||
| 1 | + | all: false | |
| 2 | + | formatter: goimports | |
| 3 | + | force-file-write: true | |
| 4 | + | structname: '{{.Mock}}{{.InterfaceName}}' | |
| 5 | + | template: testify | |
| 6 | + | template-schema: '{{.Template}}.schema.json' | |
| 7 | + | require-template-schema-exists: true | |
| 8 | + | packages: {} | |
| @@ -0,0 +1,8 @@ | |||||
| 1 | + | all: false | |||
| 2 | + | formatter: goimports | |||
| 3 | + | force-file-write: true | |||
| 4 | + | structname: '{{.Mock}}{{.InterfaceName}}' | |||
| 5 | + | template: testify | |||
| 6 | + | template-schema: '{{.Template}}.schema.json' | |||
| 7 | + | require-template-schema-exists: true | |||
| 8 | + | packages: {} | |||
A AGENTS.md +10 -0
| @@ -0,0 +1,10 @@ | |||
| 1 | + | # Repository rules | |
| 2 | + | ||
| 3 | + | - Go 1.27 only. Normal builds/tests use CGO_ENABLED=0; race tests use CGO_ENABLED=1. | |
| 4 | + | - Library: return errors, never log. No application policy (shortcuts, which outputs to cover, when to lock). | |
| 5 | + | - Owner goroutine: only the reader and the epoll waker run concurrently; all state changes happen in `Dispatch` on the caller's goroutine. | |
| 6 | + | - Zero allocations in steady state (dispatch, present, release, key). Guard every hot path with a `TestAlloc*` test using `testing.AllocsPerRun`; `make perf-check` runs them. | |
| 7 | + | - Mockery v3 testify generated mocks only; no handwritten fakes/stubs/spies. Public interfaces get mocks in `mocks/`; unexported seams get same-package `*_mock_test.go`. Add `.mockery.yml` entries and run `make mocks-check`. | |
| 8 | + | - Secrets never become `string`, never reach logs, errors or `KeyEvent.Text`; scratch buffers are wiped after use. | |
| 9 | + | - Signed conventional commits only. No push, tag or release without authorization. | |
| 10 | + | - Local development resolves sibling modules through a gitignored `go.work`; committed `go.mod` never contains `replace`. | |
| @@ -0,0 +1,10 @@ | |||||
| 1 | + | # Repository rules | |||
| 2 | + | ||||
| 3 | + | - Go 1.27 only. Normal builds/tests use CGO_ENABLED=0; race tests use CGO_ENABLED=1. | |||
| 4 | + | - Library: return errors, never log. No application policy (shortcuts, which outputs to cover, when to lock). | |||
| 5 | + | - Owner goroutine: only the reader and the epoll waker run concurrently; all state changes happen in `Dispatch` on the caller's goroutine. | |||
| 6 | + | - Zero allocations in steady state (dispatch, present, release, key). Guard every hot path with a `TestAlloc*` test using `testing.AllocsPerRun`; `make perf-check` runs them. | |||
| 7 | + | - Mockery v3 testify generated mocks only; no handwritten fakes/stubs/spies. Public interfaces get mocks in `mocks/`; unexported seams get same-package `*_mock_test.go`. Add `.mockery.yml` entries and run `make mocks-check`. | |||
| 8 | + | - Secrets never become `string`, never reach logs, errors or `KeyEvent.Text`; scratch buffers are wiped after use. | |||
| 9 | + | - Signed conventional commits only. No push, tag or release without authorization. | |||
| 10 | + | - Local development resolves sibling modules through a gitignored `go.work`; committed `go.mod` never contains `replace`. | |||
A LICENSE +21 -0
| @@ -0,0 +1,21 @@ | |||
| 1 | + | MIT License | |
| 2 | + | ||
| 3 | + | Copyright (c) 2026 neferclient contributors | |
| 4 | + | ||
| 5 | + | Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 6 | + | of this software and associated documentation files (the "Software"), to deal | |
| 7 | + | in the Software without restriction, including without limitation the rights | |
| 8 | + | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 9 | + | copies of the Software, and to permit persons to whom the Software is | |
| 10 | + | furnished to do so, subject to the following conditions: | |
| 11 | + | ||
| 12 | + | The above copyright notice and this permission notice shall be included in all | |
| 13 | + | copies or substantial portions of the Software. | |
| 14 | + | ||
| 15 | + | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | + | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | + | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
| 18 | + | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | + | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 20 | + | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
| 21 | + | SOFTWARE. | |
| @@ -0,0 +1,21 @@ | |||||
| 1 | + | MIT License | |||
| 2 | + | ||||
| 3 | + | Copyright (c) 2026 neferclient contributors | |||
| 4 | + | ||||
| 5 | + | Permission is hereby granted, free of charge, to any person obtaining a copy | |||
| 6 | + | of this software and associated documentation files (the "Software"), to deal | |||
| 7 | + | in the Software without restriction, including without limitation the rights | |||
| 8 | + | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
| 9 | + | copies of the Software, and to permit persons to whom the Software is | |||
| 10 | + | furnished to do so, subject to the following conditions: | |||
| 11 | + | ||||
| 12 | + | The above copyright notice and this permission notice shall be included in all | |||
| 13 | + | copies or substantial portions of the Software. | |||
| 14 | + | ||||
| 15 | + | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
| 16 | + | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
| 17 | + | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
| 18 | + | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
| 19 | + | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
| 20 | + | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||
| 21 | + | SOFTWARE. | |||
A Makefile +22 -0
| @@ -0,0 +1,22 @@ | |||
| 1 | + | .PHONY: build test vet race mocks mocks-check fakes-check perf-check check | |
| 2 | + | ||
| 3 | + | build: | |
| 4 | + | CGO_ENABLED=0 go build ./... | |
| 5 | + | test: | |
| 6 | + | CGO_ENABLED=0 go test ./... | |
| 7 | + | vet: | |
| 8 | + | CGO_ENABLED=0 go vet ./... | |
| 9 | + | race: | |
| 10 | + | CGO_ENABLED=1 go test -race ./... | |
| 11 | + | mocks: | |
| 12 | + | mockery | |
| 13 | + | mocks-check: mocks | |
| 14 | + | git diff --exit-code -- mocks ':(glob)**/*_mock_test.go' | |
| 15 | + | @test -z "$$(git ls-files --others --exclude-standard -- mocks ':(glob)**/*_mock_test.go')" | |
| 16 | + | fakes-check: | |
| 17 | + | @rc=0; grep -rniE '^\s*type\s+\w*(fake|stub|spy|dummy|mock)\w*|^\s*\w*(fake|stub|spy|dummy|mock)\w*(\[[^]]*\])?\s+(struct|interface)\b' --include='*_test.go' --exclude='*_mock_test.go' . 2>/dev/null || rc=$$?; \ | |
| 18 | + | [ $$rc -eq 1 ] || { [ $$rc -eq 0 ] && printf '%s\n' 'handwritten test double: generate with Mockery v3' >&2; exit 1; } | |
| 19 | + | perf-check: | |
| 20 | + | CGO_ENABLED=0 go test -run 'TestAlloc' -count=1 ./... | |
| 21 | + | check: build vet test fakes-check perf-check | |
| 22 | + | CGO_ENABLED=0 staticcheck ./... | |
| @@ -0,0 +1,22 @@ | |||||
| 1 | + | .PHONY: build test vet race mocks mocks-check fakes-check perf-check check | |||
| 2 | + | ||||
| 3 | + | build: | |||
| 4 | + | CGO_ENABLED=0 go build ./... | |||
| 5 | + | test: | |||
| 6 | + | CGO_ENABLED=0 go test ./... | |||
| 7 | + | vet: | |||
| 8 | + | CGO_ENABLED=0 go vet ./... | |||
| 9 | + | race: | |||
| 10 | + | CGO_ENABLED=1 go test -race ./... | |||
| 11 | + | mocks: | |||
| 12 | + | mockery | |||
| 13 | + | mocks-check: mocks | |||
| 14 | + | git diff --exit-code -- mocks ':(glob)**/*_mock_test.go' | |||
| 15 | + | @test -z "$$(git ls-files --others --exclude-standard -- mocks ':(glob)**/*_mock_test.go')" | |||
| 16 | + | fakes-check: | |||
| 17 | + | @rc=0; grep -rniE '^\s*type\s+\w*(fake|stub|spy|dummy|mock)\w*|^\s*\w*(fake|stub|spy|dummy|mock)\w*(\[[^]]*\])?\s+(struct|interface)\b' --include='*_test.go' --exclude='*_mock_test.go' . 2>/dev/null || rc=$$?; \ | |||
| 18 | + | [ $$rc -eq 1 ] || { [ $$rc -eq 0 ] && printf '%s\n' 'handwritten test double: generate with Mockery v3' >&2; exit 1; } | |||
| 19 | + | perf-check: | |||
| 20 | + | CGO_ENABLED=0 go test -run 'TestAlloc' -count=1 ./... | |||
| 21 | + | check: build vet test fakes-check perf-check | |||
| 22 | + | CGO_ENABLED=0 staticcheck ./... | |||
A README.md +16 -0
| @@ -0,0 +1,16 @@ | |||
| 1 | + | # neferclient | |
| 2 | + | ||
| 3 | + | A Wayland client toolkit library for Go: connection, outputs, surface roles, seat and DMA-BUF presentation. It does not render and holds no application policy. No cgo required. | |
| 4 | + | ||
| 5 | + | > [!WARNING] | |
| 6 | + | > **Early development.** No release yet. Expect bugs and breaking changes. | |
| 7 | + | ||
| 8 | + | ## Requirements | |
| 9 | + | ||
| 10 | + | - Linux, kernel 6.6 or newer (DRM syncobj eventfd). | |
| 11 | + | - A compositor advertising `zwp_linux_dmabuf_v1` (v4) and `wp_linux_drm_syncobj_manager_v1`. | |
| 12 | + | - `libxkbcommon` at runtime for keyboard input. | |
| 13 | + | ||
| 14 | + | ## License | |
| 15 | + | ||
| 16 | + | MIT | |
| @@ -0,0 +1,16 @@ | |||||
| 1 | + | # neferclient | |||
| 2 | + | ||||
| 3 | + | A Wayland client toolkit library for Go: connection, outputs, surface roles, seat and DMA-BUF presentation. It does not render and holds no application policy. No cgo required. | |||
| 4 | + | ||||
| 5 | + | > [!WARNING] | |||
| 6 | + | > **Early development.** No release yet. Expect bugs and breaking changes. | |||
| 7 | + | ||||
| 8 | + | ## Requirements | |||
| 9 | + | ||||
| 10 | + | - Linux, kernel 6.6 or newer (DRM syncobj eventfd). | |||
| 11 | + | - A compositor advertising `zwp_linux_dmabuf_v1` (v4) and `wp_linux_drm_syncobj_manager_v1`. | |||
| 12 | + | - `libxkbcommon` at runtime for keyboard input. | |||
| 13 | + | ||||
| 14 | + | ## License | |||
| 15 | + | ||||
| 16 | + | MIT | |||
A doc.go +4 -0
| @@ -0,0 +1,4 @@ | |||
| 1 | + | // Package neferclient is a Wayland client toolkit library for Go: connection, | |
| 2 | + | // outputs, surface roles, seat and DMA-BUF presentation. It does not render | |
| 3 | + | // and holds no application policy. | |
| 4 | + | package neferclient | |
| @@ -0,0 +1,4 @@ | |||||
| 1 | + | // Package neferclient is a Wayland client toolkit library for Go: connection, | |||
| 2 | + | // outputs, surface roles, seat and DMA-BUF presentation. It does not render | |||
| 3 | + | // and holds no application policy. | |||
| 4 | + | package neferclient | |||
A go.mod +3 -0
| @@ -0,0 +1,3 @@ | |||
| 1 | + | module github.com/bnema/neferclient | |
| 2 | + | ||
| 3 | + | go 1.27 | |
| @@ -0,0 +1,3 @@ | |||||
| 1 | + | module github.com/bnema/neferclient | |||
| 2 | + | ||||
| 3 | + | go 1.27 | |||