chore: replace rakyll/statik with stdlib //go:embed#82
Merged
Conversation
`rakyll/statik` has been functionally obsolete since Go 1.16 (Feb 2021) landed `//go:embed`. Replace the whole chain: blank import + generated 3 MB statik/statik.go + manual `make generate-statik` step are all gone, and the OpenAPI Swagger UI assets are now bundled into the binary directly via the stdlib `embed` package. Changes: - Move third_party/OpenAPI/ -> openapi/assets/. Delete the now-empty third_party/ tree. buf.gen.yaml's openapiv2 output path updated to match (`out: openapi/assets`). - New openapi/ package with `//go:embed assets` exposing `embed.FS`. servers/gateway/gateway.go uses `fs.Sub` + `http.FS` to serve. - Drop rakyll/statik from go.mod (and tools.go's blank import — without that, `go mod tidy` would have kept the dep). Makefile's `generate` target loses the `statik` invocation; `install` target loses the rakyll/statik entry. magefile.go gets the parallel edits. - statik/statik.go deleted from disk; the directory is empty and gone. Side effect: the blank import `_ "github.com/7cav/api/statik"` that broke Dependabot's gomod scan on clean clones (the gitignored target made `go list` fail) is gone at the root. PR #59's check-in of the generated statik file was a stopgap for exactly this — that stopgap now retires. Verified: - go vet ./... clean - go build ./... clean - make generate succeeds (only buf runs now); swagger.json output lands in openapi/assets/ at the new path - rg statik returns zero hits in the working tree - Container OpenAPI handler smoke at http://localhost:11000/: Swagger UI renders, zero console errors, all 13 embedded files (index, oauth2-redirect, both swagger.json, CSS, four JS bundles, two favicons, LICENSE) return 200 - Insomnia suite 61/61 green against the local stack Closes #58 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
rakyll/statikstatic-asset toolchain with Go's stdlib//go:embed(available since Go 1.16, Feb 2021).third_party/OpenAPI/→openapi/assets/. Newopenapipackage with//go:embed assetsexposing the bundle as anembed.FS. Gateway serves it viafs.Sub+http.FS.rakyll/statikfromgo.mod,tools.go, theMakefilegenerate+installtargets, andmagefile.go. Deletestatik/statik.go.buf.gen.yaml'sopenapiv2output path updated toopenapi/assets.Why now
rakyll/statikhas been functionally obsolete since stdlibembedshipped. The blank-import_ "github.com/7cav/api/statik"was also the root cause of Dependabot'sgo_modulesscan silently failing on this repo (PR #59 worked around this by checking in the generatedstatik/statik.go). With the blank import gone, that stopgap retires —statik/statik.gois deleted in this PR.Closes #58.
Test plan
go vet ./...cleango build ./...cleanmake generatesucceeds; swagger.json files land inopenapi/assets/at the new pathrg statikreturns zero hits in the working treehttp://localhost:11000/: Swagger UI renders, zero console errors, all 13 embedded files (index, oauth2-redirect, both swagger.json, CSS, four JS bundles, two favicons, LICENSE) return 200🤖 Generated with Claude Code