Conversation
Move MapLibre glyph PBF files from assets/fonts/ into internal/fonts/glyphs/ and serve them from the embedded FS. This removes the OCAP_FONTS config option and simplifies deployment to a single binary.
Merging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. |
Summary of ChangesHello @fank, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors how font assets are handled by embedding them directly into the Go binary using 'go:embed'. This change eliminates the need for external font directories and associated Dockerfile instructions, leading to a more self-contained and streamlined application build and deployment process. It also simplifies configuration by removing a dedicated font path setting. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors how fonts are handled by embedding them directly into the Go binary using go:embed. This simplifies deployment by removing the need for a separate fonts directory and associated configuration. The changes in the Dockerfile and the file structure are correct and align with the goal. I've identified a potential issue with the go:embed directive in internal/fonts/fonts.go that would likely cause the font serving endpoint to fail with 404 errors. I've provided a suggestion to adjust the embed path pattern to resolve this.
|
|
||
| import "embed" | ||
|
|
||
| //go:embed all:glyphs |
There was a problem hiding this comment.
The go:embed directive all:glyphs embeds the glyphs directory itself. This means file paths within GlyphsFS will be prefixed with glyphs/ (e.g., glyphs/OpenSans-Bold/0-255.pbf).
Given the test plan's curl command, the server is expected to serve files from /fonts/ without this glyphs/ prefix, which would lead to 404 errors.
To fix this, you can adjust the embed pattern to strip the glyphs/ prefix from the embedded file paths.
| //go:embed all:glyphs | |
| //go:embed all:glyphs/* |
Summary
assets/fonts/intointernal/fonts/glyphs/and serve viaembed.FSOCAP_FONTSconfig option (Setting.Fontsfield, env var, viper default)COPYandENVfrom Dockerfile — fonts are now baked into the binaryTest plan
go build ./cmd/ocap-webservercompiles with embedded fontsgo test ./...passes (pre-existing maptool failure unrelated)curl -I localhost:5000/fonts/OpenSans-Bold/0-255.pbf