feat: embed error.html template and move loading to main#10
Merged
Conversation
- Bundle error.html template using go:embed for self-contained binaries - Move template loading from init() to main() after logging setup - Remove template file copy from Dockerfile since templates are embedded - Add proper error template initialization with structured logging - Support ko builds with no external file dependencies - Remove template copy from Dockerfile 🤖 Generated with GitHub Copilot (via Zed) Signed-off-by: Eric Searcy <eric@linuxfoundation.org>
There was a problem hiding this comment.
Pull Request Overview
This PR embeds the error.html template directly into the binary using go:embed, eliminating the need for external template files at runtime. This change enables self-contained builds (like ko) and simplifies deployment.
Key changes:
- Template content is now embedded at compile time using go:embed directive
- Template initialization moved from init() to main() to ensure proper logging context
- Dockerfile no longer needs to copy template files since they're embedded in the binary
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| responses.go | Adds go:embed directive to bundle error.html template and refactors template initialization into a callable function |
| main.go | Calls initErrorTemplate() after logging setup to ensure template errors are properly logged |
| Dockerfile | Removes template file copy step since templates are now embedded in the binary |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
🤖 Generated with GitHub Copilot (via Zed)