diff --git a/.hooks/pre-commit b/.hooks/pre-commit new file mode 100755 index 0000000..aeb4b9c --- /dev/null +++ b/.hooks/pre-commit @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +make lint diff --git a/api/robots.go b/api/robots.go index 82cfa7e..d066485 100644 --- a/api/robots.go +++ b/api/robots.go @@ -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") diff --git a/makefile b/makefile index 6552603..dafcbe6 100644 --- a/makefile +++ b/makefile @@ -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