serverless/#
The Go backend (#547), ported from Quarkus: cmd/api serves every route of the contract, on
Lambda or as a plain HTTP server; cmd/streams, cmd/orphans and cmd/replay are its
background functions, cmd/logship sends the logs to the monitoring server (#508), and cmd/push
sends a change to a task to its owner's other devices (#277). build.sh packages all six for
Lambda; serverless.tf, serverless-jobs.tf and push.tf in
deployment/aws-tofu/modules/environment/ create the functions (#554).
doc/deployment/serverless.md has the design and how to run it.
Gunnar does not write or read Go by choice, so the code has to be reviewable by what it does:
- Every package and exported identifier has a doc comment saying what it is for, the Go counterpart of the frontend's TSDoc rule, and of the Quarkus backend's Javadoc rule before it.
- The domain imports no AWS package.
internal/boardis plain Go; Lambda's event types stay incmd/andinternal/lambdahttp, DynamoDB's ininternal/store, S3's ininternal/files, Secrets Manager's ininternal/secrets, Lambda'sInvokeininternal/notify. That is the line that keeps the AWS lock-in (one of the decision's drawbacks) to the edges. - Tests sit next to the code (
*_test.go), with fakes for the one AWS call each part makes, and TDD holds as everywhere else in the repository. - gofmt,
go vetandgo test -raceare what Serverless CI runs; run them before a commit. The store's tests start DynamoDB Local through Testcontainers, the files' tests LocalStack: without podman or docker they are skipped on a developer machine, never in CI. With podman, run them withTESTCONTAINERS_RYUK_DISABLED=true: Ryuk, Testcontainers' clean-up container, asks for Docker'sbridgenetwork, which podman does not have, and each test stops its own container. - The wire format is the API's,
doc/api/openapi.json.internal/api/api.gen.gois generated from it bygo generate ./...(oapi-codegen, atoolingo.mod) and never edited;tools/contractgenadds one rule on the way, that a field which may be null is sent as null, as Quarkus sent it.internal/api/contract_test.gochecks responses against the contract. - The time zones a task takes are
internal/board/zones.gen.go, generated bygo generate(tools/zonesgen) from the Go toolchain's own tzdata, and drift-gated likeapi.gen.go. A list, becausetime.LoadLocationreads the system's zone files first, and macOS's disk ignores case. A Go release with new tzdata fails the drift check untilgo generate ./...is run with thego.modversion, which a newer local Go does not switch down to. - Behaviour matches the Quarkus backend's, not just the schema. Where the contract allows
more than one answer, the Go code gives the one Quarkus gave: the apps in use were built against
it. Its code is in the tag
pre-serverless(#559).