chore: lint command and hook

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-06-24 16:11:10 -03:00
parent 9909b671f3
commit 6c784b7036
3 changed files with 10 additions and 1 deletions

3
.hooks/pre-commit Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
make lint

View File

@@ -19,7 +19,10 @@ func RobotsTxt(w http.ResponseWriter, r *http.Request) {
if error("Error trying to read ai block list", err, http.StatusInternalServerError) {
return
}
w.Write(bytes)
_, err = w.Write(bytes)
if error("Error trying to write ai block list", err, http.StatusInternalServerError) {
return
}
w.Header().Add("Cache-Control", "max-age=604800, stale-while-revalidate=86400, stale-if-error=86400")
w.Header().Add("CDN-Cache-Control", "max-age=604800")

View File

@@ -1,5 +1,8 @@
PORT?=8080
lint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1 run
build: templ
go build -o bin/www