- go install github.com/cosmtrek/air@latest
- go install github.com/amacneil/dbmate@latest
- go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
- go install honnef.co/go/tools/cmd/staticcheck@latest
- go install github.com/securego/gosec/v2/cmd/gosec@latest
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
dbmate up
templ generate
air
cd webapp && npx tailwindcss -i ../static/base.css -o ../static/index.css --watch
DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable
DBMATE_MIGRATIONS_DIR=migrations/
DBMATE_SCHEMA_FILE=schema.sql
COOKIE_SECRET=`head -c32 </dev/urandom | xxd -p -u`
OTEL_EXPORTER_OTLP_ENDPOINT=localhost:4318
- https://betterstack.com/community/guides/logging/logging-in-go/
- Use .WithGroup() to keep additional data in subgroup
- Switch to JSON in prod
- https://github.com/open-telemetry/opentelemetry-go-contrib
- https://opentelemetry.io/ecosystem/registry/?language=go&component=instrumentation
- new way to handle start date (
race.StartAt, err = time.ParseInLocation("2006-01-02T15:04", r.FormValue("start_at"), paris)
)
- logging only in middleware, command, query, ...
- do not use ErrNoRows in commands
- log success before return
- no string literal for status
- force use of ParseMultipartForm
- use
http.HandlerFunc
instead offunc(w http.ResponseWriter, r *http.Request)
- avoid calling function inside core.Expect ?
- race/domain vs race/http? but module name matters...
- Speedup CI with cache of deps
- Allow to change lang
- https://go.dev/doc/go1.21
- try to split external styling (width, margin, ...) from internal (row, color, padding, ...)
- pgx recover
- tracing
- linting to remove old patterns
- Improve templates
- define where from slog errors
- HTMX to some point
- https://htmx.org/docs/
- https://htmx.org/essays/template-fragments/
- https://gist.github.com/benpate/f92b77ea9b3a8503541eb4b9eb515d8a
- how to return errors? for forms?
- experiment with aggregation independance
- try a pattern of function builder to prepare logger in advance etc
- also guards, a bit django like
- UserID vs RaceID vs ...
- .With(middleware.SetHeader("Cache-Control", "max-age=3600")) => not in dev, should it be golang?
- https://github.com/samber/do
- https://github.com/samber/mo
if !ok {
err := errors.New("user not logged in")
slog.Warn(err.Error())
return http.StatusUnauthorized, err
}