"""Task go_htmx: a SITU-shape Go web app with HTMX partials and a multi-table SQLite schema. Single Go binary: server-rendered html/template + HTMX partial swaps, embedded SQLite (modernc.org/sqlite), a self-referential location tree read via a recursive CTE, assets via //go:embed. Gates: build; test (`go test -v ./...` exits 0 with >= 1 passing test); serves (GET / has
db -> migrate -> handlers -> ListenAndServe + graceful shutdown internal/config/config.go Config{Port, DBPath}; LoadFromEnv() reads NOTES_PORT (port, int) and NOTES_DB (db path) — MUST use these exact env var names; the scoring harness sets them. internal/db/db.go Open(dsn): modernc sqlite, PRAGMA WAL+busy_timeout+FK on; Migrate() via embedded .sql internal/db/migrations/00001_init.sql the schema above (both tables + the unique index) internal/models/location.go Location struct + Create(db, name, parentID) + Tree(db) — Tree returns a flat list with depth via a recursive CTE: WITH RECURSIVE tree AS (SELECT id, name, parent_id, 0 AS depth FROM locations WHERE parent_id IS NULL UNION ALL SELECT l.id, l.name, l.parent_id, t.depth+1 FROM locations l JOIN tree t ON l.parent_id = t.id) SELECT id, name, parent_id, depth FROM tree ORDER BY depth, name internal/handlers/handlers.go Handlers struct; routes via stdlib net/http ServeMux: GET / (full page: form + tree), POST / (create location: form fields name + parent_id; returns JUST the updated tree fragment as an HTML partial for HTMX swap, Content-Type text/html, status 200 — NOT a redirect, NOT a full page) internal/handlers/handlers_test.go httptest: POST a root location, assert the response body contains the location name indented by depth (one leading space pair per depth level); POST a child, assert it appears nested under the parent web/templates/page.html the full page: pulls in HTMX (a is fine), a form (name input + hidden parent_id input + submit) with hx-post="/" hx-target="#tree" hx-swap="innerHTML", and a
containing the rendered tree web/templates/tree.html the tree fragment: renders the locations as a nested