Skip to content

Commit 5c7fa49

Browse files
committed
chore: turns hidden files aren't cool for embedding
1 parent 6c80056 commit 5c7fa49

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

web/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ yarn-error.log*
2626
package-lock.json
2727

2828
dist/*
29-
!dist/.gitkeep
29+
!dist/README.md
3030
/history
3131

3232
#editors

web/dist/.gitkeep

Whitespace-only changes.

web/dist/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Keeping this file as a placeholder for //got:embed dist to work

web/static.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,19 @@ func (web *Web) rootHandler(w http.ResponseWriter, r *http.Request) {
7171

7272
// Execute the template and write to the buffer
7373
err = htmlTemplate.Execute(buf, data)
74-
75-
// Write the buffer contents to the response writer
76-
_, _ = buf.WriteTo(w)
7774
if err != nil {
7875
web.logger.WithError(err).
7976
Info("failed to execute HTML template")
8077
http.Error(w, "Template execution error", 500)
8178
}
79+
80+
// Write the buffer contents to the response writer
81+
_, err = buf.WriteTo(w)
82+
if err != nil {
83+
web.logger.WithError(err).
84+
Info("failed to write response")
85+
return
86+
}
8287
}
8388

8489
func (web *Web) RegisterRoutes(router *mux.Router) {

0 commit comments

Comments
 (0)