ci: fix embed build, add Go + frontend linting and git hooks#10
Merged
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
CI was failing with:
frontend/dist/is gitignored (it's a build output), so on a clean CI checkout the//go:embed all:frontend/distdirective has nothing to embed andgo vet/go buildfail.What's in here
Fix the build
frontend/dist/.gitkeep; update.gitignoreto ignore the contents but keep the directory. The embed now resolves on any clean checkout.Linting
.golangci.yml(errcheck, gosimple, govet, ineffassign, staticcheck, unused, gofmt, misspell) + a dedicatedlintCI job usinggolangci/golangci-lint-action@v6.@typescript-eslint,react-hooks) wired vianpm 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-lintif installed, frontend lint + build).Makefilewithhooks/setup/lint/test/buildtargets. Enable hooks withmake hooks.Small Go fixes surfaced by the linter
Header.value→Header.Value(the unexported field meant header values were silently dropped during JSON export).bytes.Buffer.String()instead ofstring(b.Bytes()).f.Writeerror inExport.Validated locally
The pre-push hook ran on this very push and passed:
go vet,go test,golangci-lint, frontend lint + build, all green.