Go Package Discovery Gets a Proper API
A developer-tooling announcement from last month deserves a little more attention: on May 21, the Go team introduced an official API for pkg.go.dev. It gives tools a structured way to ask about published modules and packages instead of extracting information from pages designed for people.
That sounds like plumbing, and it is exactly why I like it. Documentation sites often become accidental APIs. Someone needs a package synopsis or a list of versions, writes a scraper, and eventually discovers that a harmless layout change has broken their workflow.
What is actually available?
According to the launch announcement, the interface is stateless and GET-only, with endpoints under /v1beta. It covers package and module information, module versions, search, declared symbols, importing packages, and vulnerability information. There is also a machine-readable OpenAPI specification, which should make client generation and integration work much less guess-heavy.
The version parameter matters as much as the endpoint list. An editor showing documentation for one dependency version should not silently describe the latest release instead. The API supports specific semantic versions and can resolve the supported development branch names, main and master, to pseudo-versions.
A useful refusal to guess
One interesting design decision is how it handles ambiguous package paths. A package may be provided by more than one module, particularly after a repository is split into submodules. Where the website can choose a module for convenient browsing, the API asks clients to identify the module explicitly when the result is ambiguous.
I would rather have a tool stop and ask for precision than confidently attach documentation from the wrong module. That distinction becomes especially important when an AI coding assistant is gathering context: valid-looking information is not necessarily information about the code actually in the build.
Where this could help
The obvious uses are editor integrations and package search, but dependency-review tooling is interesting too. A small dashboard could combine a pinned module version, its exported symbols, and links to relevant vulnerability records. That would be a useful starting point for review, rather than a substitute for checking how a dependency is used.
The beta path is a reminder to build defensively: handle errors, cache appropriate responses, and keep assumptions about response shapes in one place. My takeaway is simple: reliable tooling starts with reliable interfaces, and giving package metadata a formal home is a welcome improvement.
Sources and further reading
- Go Blog: Introducing the pkg.go.dev API — May 21, 2026.
- pkg.go.dev API reference.