Skip to content

chore: adopt Go library-quality standard (format, lint, coverage, docs)#2

Draft
AndroidPoet wants to merge 1 commit into
masterfrom
chore/library-standard
Draft

chore: adopt Go library-quality standard (format, lint, coverage, docs)#2
AndroidPoet wants to merge 1 commit into
masterfrom
chore/library-standard

Conversation

@AndroidPoet

Copy link
Copy Markdown
Owner

Summary

Brings the project up to a Go library-quality baseline across four pillars: formatting, linting/static analysis, test-coverage tooling, and a documentation website. No runtime behavior changes — the source edits are lint/format fixes that preserve existing logic.

Pillars

1. Formatting — gofumpt

  • Adopted gofumpt as the canonical formatter and reformatted the whole codebase.
  • make fmt (write) and make fmt-check (CI-style gate) targets added.
  • CI fails if anything is not gofumpt-formatted.

2. Linting / static analysis — golangci-lint

  • Expanded .golangci.yml (schema v2) from 2 linters to a sensible default set: govet, staticcheck, errcheck, ineffassign, unused, plus bodyclose, noctx, nilerr, errorlint, gocritic, prealloc, whitespace, misspell, unconvert, revive, with gofumpt + goimports as formatters.
  • Fixed every surfaced issue (≈65): unchecked errors, exec.Commandexec.CommandContext, capitalized error strings, a deprecated strings.Title call, a dead assignment, prealloc, and more.
  • CI runs golangci-lint via the official action.

3. Test coverage

  • go test ./... -coverprofile=coverage.out -covermode=atomic wired into a make cover task that emits both an HTML report and a per-function summary (plus make cover-func).
  • CI adds a coverage step and uploads coverage.out as an artifact.
  • Note: existing test coverage is low (only internal/cli and internal/output have tests). This PR wires up the tooling; broadening test coverage is intentionally out of scope and left as follow-up.

4. Docs site

  • New Next.js docs site under website/ (static export, served from GitHub Pages under the repo sub-path).
  • Project-specific content written from scratch: Introduction, Installation, Getting Started, Usage, Command Reference (Setup & Auth, Catalog, Customers & Subscriptions, Analytics & Reports, Operations), Configuration, and Output & Scripting.
  • The docs CI workflow now builds and deploys the static export; the previous docs pipeline and its sources were removed to avoid two competing systems.

Verification (run locally)

Check Result
gofumpt -l . empty (clean)
go build ./... pass
go vet ./... pass
go test ./... pass
golangci-lint run ./... 0 issues
make cover HTML + func report produced
docs pnpm build 16 static pages exported

Notes

  • No pillar skipped. Coverage tooling is fully wired; raising the coverage number is deliberately follow-up work.
  • go mod tidy promoted golang.org/x/text to a direct dependency (used to replace deprecated strings.Title).

Apply a four-pillar quality baseline to the project.

Formatting
- Adopt gofumpt as the canonical formatter and reformat the codebase.
- Add make fmt / make fmt-check targets and a CI gofumpt gate.

Linting
- Expand .golangci.yml (v2) to a sensible default set: govet, staticcheck,
  errcheck, ineffassign, unused, gofumpt, goimports, plus bodyclose, noctx,
  nilerr, errorlint, gocritic, prealloc, whitespace, misspell, unconvert,
  revive.
- Fix all surfaced issues so the linter passes clean (errcheck, noctx,
  capitalized errors, deprecated strings.Title, dead assignments, etc.).
- Run golangci-lint in CI via the official action.

Coverage
- Wire go test with -coverprofile/-covermode=atomic.
- Add make cover (HTML + func reports) and make cover-func targets.
- Add a coverage step + artifact upload to CI.

Docs
- Add a Next.js documentation site under website/ with project-specific
  content: introduction, installation, getting started, usage, command
  reference, configuration, and output/scripting guides.
- Replace the previous docs pipeline; deploy the static export to Pages.
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.

1 participant