Go code tidy pass — review against Effective Go, Practical Go, and standard library conventions, then run go fmt, go vet, and staticcheck.
Review all Go code in this repository against three authorities:
http.HTTPServer is wrong, http.Server is right. ofac.OFACImport is wrong, ofac.Import is right.base, common, util, or helpers. Name packages after what they provide, not what they contain.i, r, w). Long-lived → descriptive names. The length of a variable name should be proportional to the distance between its declaration and use.publishID, every file calls it publishID.ctx.err (or xxxErr when you need two in scope).io.Reader, io.Writer) over large ones.fmt.Errorf("reading config: %w", err) — always describe what failed, not why.var ErrNotFound = errors.New(...)) should be used sparingly. Prefer error wrapping.context.Context for cancellation and deadlines — never bare goroutines with no shutdown path.cmd/ for binaries, internal/ for private packages. This is not optional.The standard library is the style guide. Write code that looks like it belongs in net/http, database/sql, or encoding/json.
// Server is ..., // Import loads ....doc.go unless the comment is long.// Close closes the connection adds nothing. // Close releases the database connection and waits for in-flight queries to finish does.context.Context is always the first parameter. No exceptions.error is always the last return value.func New(...) *T for constructors. If there's only one obvious type in the package, New is fine. If ambiguous, NewServer, NewWatcher.Server, Watcher, Entry). Methods are verbs (Run, Close, Import).Reader, Writer, Handler — not IReader or Readable.io.Reader/io.Writer: small interfaces composed into larger ones.http.Handler: single-method interfaces enable composition via middleware.sql.DB: pool management hidden behind a clean API. Callers don't manage connections.json.Encoder/json.Decoder: streaming over buffering when data can be large.context.WithTimeout/context.WithCancel: explicit lifetime management, never implicit.errors.Is/errors.As: check error types through the chain, don't compare strings.testing package conventions)TestFunctionName, TestType_Method, or TestFunctionName_condition.t.Run for subtests. Name each case clearly.t.Helper() in test helpers so failures report the caller's line.t.Cleanup() for teardown instead of defer when the cleanup depends on the test context.testdata/ directory for test fixtures. _test.go files only.goimports handles this automatically.After reviewing the code, run the following and fix any issues found:
go fmt ./...
go vet ./...
goimports -w $(find . -name '*.go' -not -path './vendor/*')
staticcheck ./...