Should I author the OpenAPI spec first or generate it from my code?
Go contract-first with openapi.yaml as the single source of truth; what ends drift isn't the direction you pick but a green contract test running in CI.
Just Ask
Ask me anything about software architecture, careers, PHP, Go and the craft of building software; I answer here, in the open, for everyone. (Page 4/10)
The questions here are compiled from what I have run into in the field and from what people have asked me; I write the answers. No record carries the name of whoever asked.
Go contract-first with openapi.yaml as the single source of truth; what ends drift isn't the direction you pick but a green contract test running in CI.
Build the partial index on WHERE status='pending', include the ORDER BY column, pair it with FOR UPDATE SKIP LOCKED, and pass 'pending' literally.
Cancellation propagates only if you pass r.Context() into every downstream call, leave no context.Background() in the chain, and use WithoutCancel.
Integer cents in the DB, an immutable Money on the model: put the mapping in one CastsAttributes class and keep currency as a second column there.
Default to list<Order> docblocks with strict PHPStan in CI; add one generic Collection<T> for behavior, a concrete class only at a trust boundary.
Turn the promotion into a concrete move: pick one fuzzy problem nobody owns and carry it end to end for a quarter, from its definition to its rollout.
Log at ERROR when the line would wake someone at 3am and at WARN when it would not, log a failure once at its boundary, and alert on the ERROR rate.
Define readiness, liveness and startup as Kubernetes probes; keep HEALTHCHECK only if the image also runs under Compose, pointing both at one endpoint.
Instrument usage per partner, publish a dated sunset with Sunset and Deprecation headers on every response, run brownouts, and cut when usage nears zero.
Run EXPLAIN (ANALYZE, BUFFERS) in production, then ANALYZE the table and check n_dead_tup; tune autovacuum per-table for sessions and add a partial index.