Use this guide when editing github.com/agentstation/utc with coding agents or AI assistants.
utc.Timeis a wrapper around an unexportedtime.Time; it is not a type alias and not a full drop-in replacement fortime.Time.- Values entering through constructors, parsers, JSON/text/YAML unmarshaling, or SQL scanning must be normalized to UTC.
- Values leaving through
Time(),UTC(), JSON/text/YAML marshaling,String(), andValue()must be UTC-normalized. - Use
utc.New(time.Time)orutc.From(utc.UTC)to create values from existing time-like values. - Use
t.Time()ort.UTC()when another library requires a concretetime.Time.
- Keep the root module free of external dependencies.
- YAML codec integration belongs in
integration/yaml, not in the root module. - Keep assertion-only interface checks in
_test.gofiles unless the imported package is part of a production method signature. database/sql/driverremains a production import becauseValue() (driver.Value, error)is the standard SQL value interface.
Run these before committing behavior or docs changes:
go generate ./...
go test ./...
go test -race ./...
go test -tags=debug ./...
go vet ./...
golangci-lint run ./...
make test-yaml
(cd integration/yaml && go vet ./... && golangci-lint run ./... && go test -race ./...)- Keep README prose consistent with generated API docs.
- Use semver tags such as
v0.2.0; beforev1.0.0, exported API additions normally justify a minor bump. - Do not describe the package as enforcing UTC by replacing every
time.TimeAPI. It enforces UTC at package boundaries while exposingtime.Timefor interoperability.