diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..1a5b7b4 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,23 @@ +# Agent Instructions + +## Before Committing + +Always run the build script before committing any code changes: + +```sh +./scripts/build +``` + +This runs: +- `gofmt` check (unformatted code is a hard failure) +- `go vet` +- `go build` +- `docker build` + +Fix every error and warning before proceeding to commit. If `gofmt` reports +unformatted files, run `gofmt -w .` and re-check. + +## Commit Messages + +Use concise, descriptive commit messages in imperative mood. Keep the first line +under 72 characters. diff --git a/handler/auth.go b/handler/auth.go index e44cb78..9469525 100644 --- a/handler/auth.go +++ b/handler/auth.go @@ -136,6 +136,7 @@ func (h *AuthHandler) ServeSignout(w http.ResponseWriter, r *http.Request) { }) http.Redirect(w, r, "/signin", http.StatusSeeOther) } + type contextKey string const userIDKey contextKey = "userID" diff --git a/podstalk b/podstalk new file mode 100755 index 0000000..1a25eab Binary files /dev/null and b/podstalk differ diff --git a/scripts/build b/scripts/build new file mode 100755 index 0000000..55d9f1c --- /dev/null +++ b/scripts/build @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd "$(dirname "$0")/.." + +echo "==> gofmt check" +unformatted=$(gofmt -l .) +if [ -n "$unformatted" ]; then + echo "Unformatted files:" + echo "$unformatted" + gofmt -d . + echo "Run: gofmt -w ." + exit 1 +fi +echo " ok" + +echo "==> go vet" +go vet ./... +echo " ok" + +echo "==> go build" +CGO_ENABLED=0 go build -o podstalk . +echo " ok" + +echo "==> docker build" +docker build -t podstalk . +echo " ok" + +echo "==> all checks passed" diff --git a/store/store.go b/store/store.go index bd6f8d0..d6212f6 100644 --- a/store/store.go +++ b/store/store.go @@ -8,13 +8,13 @@ import ( ) type User struct { - ID int64 - Email string - PasswordHash string - PodcastTitle string - PodcastImage string - PodcastAuthor string - CreatedAt time.Time + ID int64 + Email string + PasswordHash string + PodcastTitle string + PodcastImage string + PodcastAuthor string + CreatedAt time.Time } type Episode struct {