v0.2.0
Breaking changes
Context-first API
Client.Context has been removed. All request methods now take context.Context as their first parameter:
DoAPIRequest(ctx, method, reqURL, body, contentType)DoGet(ctx, reqURL)DoJSONPost(ctx, reqURL, body)BatchGetDocuments(ctx, names)
Migration for dependents (dkcli, gcp-docs-mirror-tools, spanner-mycli):
- Remove
Client.Contextfield assignment. - Pass
ctxas the first argument to everyClientmethod call. - If you previously relied on
Client.Contextfor cancellation/timeouts, pass that same context per call instead.
BatchGetDocuments validation
BatchGetDocuments now rejects empty name lists and more than MaxBatchGetDocuments (20) names per call. Use the new BatchGetDocumentsAll helper for larger lists (see below).
New features
MaxBatchGetDocumentsconstant — documents the API limit of 20 names perdocuments:batchGetcall.BatchGetDocumentsAll(ctx, names)— fetches documents in chunks ofMaxBatchGetDocumentswhile preserving input order.Document.ContentLengthBytes— new field mapped from the API'scontentLengthBytes.- Package documentation — added
doc.gowith godoc for thedkapipackage. - Agent instructions — added
AGENTS.md(referenced byCLAUDE.md) documenting module purpose, conventions, and verification commands. - CI workflow — GitHub Actions runs
go test -race,go vet,golangci-lint, andgovulncheckon Go 1.24 and 1.25. - Dependabot — weekly updates for Go modules and GitHub Actions.
- golangci-lint config —
.golangci.ymlwith errcheck, govet, staticcheck, and unused linters.
Fixes
CLOUDSDK_CONFIGADC resolution — whenCLOUDSDK_CONFIGorGOOGLE_APPLICATION_CREDENTIALSis set, or when the default ADC credentials file exists, token and quota-project metadata are read from that file instead of falling through to metadata-server ADC.external_accountquota project — ADC now requires a quota project forexternal_accountcredentials (in addition toauthorized_user), matchingauthorized_userbehavior.- Bounded error-body reads —
CheckResponselimits response body reads to 1 MiB for non-2xx and 429 responses, preventing unbounded memory use on error responses. NormalizeDocNamehardening — handles full URLs viaurl.Parse, strips query strings and fragments, removes trailing slashes, accepts uppercaseHTTP:///HTTPS://prefixes, and normalizes empty input todocuments/.
Documentation
- README — updated example for context-first API, documents
BatchGetDocumentsAll,CLOUDSDK_CONFIGsupport, bounded error reads, and links to pkg.go.dev.
Dependent repos
Open PRs in dkcli, spanner-mycli, and gcp-docs-mirror-tools that pin pseudo-versions of this module should update to:
go get github.com/apstndb/developerknowledge-go@v0.2.0Not included
PR #20 (expand retry policy beyond 429-only) remains open and is not part of this release.