Skip to content

ci: fix embed build, add Go + frontend linting and git hooks#10

Merged
dropdevrahul merged 1 commit into
mainfrom
ci/lint-and-hooks
Jun 13, 2026
Merged

ci: fix embed build, add Go + frontend linting and git hooks#10
dropdevrahul merged 1 commit into
mainfrom
ci/lint-and-hooks

Conversation

@dropdevrahul

Copy link
Copy Markdown
Owner

Why

CI was failing with:

main.go:12:12: pattern all:frontend/dist: no matching files found

frontend/dist/ is gitignored (it's a build output), so on a clean CI checkout the //go:embed all:frontend/dist directive has nothing to embed and go vet / go build fail.

What's in here

Fix the build

  • Track frontend/dist/.gitkeep; update .gitignore to ignore the contents but keep the directory. The embed now resolves on any clean checkout.

Linting

  • Go.golangci.yml (errcheck, gosimple, govet, ineffassign, staticcheck, unused, gofmt, misspell) + a dedicated lint CI job using golangci/golangci-lint-action@v6.
  • Frontend — ESLint (@typescript-eslint, react-hooks) wired via npm run lint; runs in the frontend CI job.

Git hooks (so this doesn't recur locally)

  • .githooks/pre-commit — gofmt enforcement.
  • .githooks/pre-push — mirrors CI (go vet, go test, golangci-lint if installed, frontend lint + build).
  • Makefile with hooks / setup / lint / test / build targets. Enable hooks with make hooks.

Small Go fixes surfaced by the linter

  • Header.valueHeader.Value (the unexported field meant header values were silently dropped during JSON export).
  • Use bytes.Buffer.String() instead of string(b.Bytes()).
  • Check the f.Write error in Export.

Validated locally

The pre-push hook ran on this very push and passed: go vet, go test, golangci-lint, frontend lint + build, all green.

- Fix the failing CI `//go:embed all:frontend/dist` error by tracking
  `frontend/dist/.gitkeep`, so the dir exists on clean checkouts
- Add `.golangci.yml` and a `lint` CI job (errcheck, gosimple, govet,
  ineffassign, staticcheck, unused, gofmt, misspell)
- Add ESLint for the frontend (`@typescript-eslint`, `react-hooks`)
  with `npm run lint` wired into CI
- Add `.githooks/pre-commit` (gofmt enforcement) and `.githooks/pre-push`
  (mirrors CI) plus a `Makefile` (`make hooks`, `make setup`, ...)
- Small Go cleanups surfaced by the linter:
  - `Header.value` → `Header.Value` so exported header values aren't dropped
  - Use `bytes.Buffer.String()` instead of `string(b.Bytes())`
  - Check the `f.Write` error in `Export`
- Update CONTRIBUTING.md and CHANGELOG.md
@dropdevrahul dropdevrahul merged commit da79b8d into main Jun 13, 2026
3 checks passed
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