Skip to content

martinlehoux/bike_race_go

Repository files navigation

Development

  • 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

Secrets

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

Logging

Tracing

Features

  • new way to handle start date (race.StartAt, err = time.ParseInLocation("2006-01-02T15:04", r.FormValue("start_at"), paris))

Linter

  • 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 of func(w http.ResponseWriter, r *http.Request)
  • avoid calling function inside core.Expect ?

Architecture

  • race/domain vs race/http? but module name matters...

TODO

if !ok {
  err := errors.New("user not logged in")
  slog.Warn(err.Error())
  return http.StatusUnauthorized, err
}

About

bike_race_go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages