_content/blog: add pkgsite api blog post
To preview this CL, download it and:
$ go run ./cmd/golangorg &
$ open http://localhost:6060/go.dev/blog/pkgsite-api
diff --git a/_content/blog/pkgsite-api.md b/_content/blog/pkgsite-api.md
new file mode 100644
index 0000000..3efdb8d
--- /dev/null
+++ b/_content/blog/pkgsite-api.md
@@ -0,0 +1,93 @@
+---
+title: Introducing the pkg.go.dev API
+date: 2026-05-11
+by:
+- Ethan Lee
+- Hana Kim
+- Jonathan Amsterdam
+summary: Introducing the new programmatic API for pkg.go.dev, allowing developers to fetch package and module data directly.
+---
+
+Since its inception, [pkg.go.dev](https://pkg.go.dev) has established itself as the primary resource for Go package documentation and discovery. While we initially prioritized creating a best-in-class web interface for users, the need for programmatic access has become increasingly clear. Developers building tools, IDE integrations, and automated workflows have historically relied on fragile workarounds like web scraping to access this data. To better address these evolving requirements, we are now expanding our platform to provide robust, direct access to the information our community needs.
+
+Today, we are excited to introduce the official [pkg.go.dev](https://pkg.go.dev) API - a stable interface for querying metadata about published Go modules. This launch is a direct response to years of community feedback. Furthermore, the need for a formalized interface has become even more acute with the rise of AI-assisted coding. Now there is the ability to access specific, high-fidelity context needed to reason about the Go ecosystem with significantly greater precision.
+
+## Motivations
+
+The primary goal of the new API is to provide the Go community programmatic access to structured, high-quality data from [pkg.go.dev](https://pkg.go.dev). The API supports use cases like these:
+
+* **Programmatic Search:** Tools can now find relevant packages based on keywords and receive structured JSON responses.
+* **Discovering Package Importers:** One of our most requested features, this allows maintainers to understand their user base and the potential impact of breaking changes.
+* **AI and LLM Integration:** The API provides a way for large language models and agents to retrieve "just-in-time" context about Go packages, ensuring they utilize the latest library versions and documentation available in the registry.
+
+## The Service Interface
+
+Built for stability and efficient caching, the API utilizes a stateless, GET-only architecture. Primary endpoints are currently hosted under the `/v1beta` path. Following a period of community feedback and confirmed stability, we intend to transition toward a formal v1 release.
+
+### Core Endpoints
+
+| Endpoint | Description |
+| :--- | :--- |
+| `/v1beta/package/{path}` | Information about the package at {path}. |
+| `/v1beta/module/{path}` | Information about the module at {path}. |
+| `/v1beta/versions/{path}` | Versions of the module at {path}. |
+| `/v1beta/packages/{path}` | Information about packages of the module at {path}. |
+| `/v1beta/search` | Search results. |
+| `/v1beta/symbols/{path}` | List of symbols declared by the package at {path}. |
+| `/v1beta/imported-by/{path}` | Paths of packages importing the package at {path}. |
+| `/v1beta/vulns/{path}` | Vulnerabilities of the module at {path}. |
+
+One design principle for this API is **Precision over Convenience**. Unlike the Go command or [pkg.go.dev](https://pkg.go.dev) UI, which use "longest module path" shortcuts, the API requires explicit resolution. If a path is ambiguous, the API returns a list of candidates to force tools to be explicit about which dependency is being queried.
+
+### Example: Raw API Request
+
+To retrieve structured metadata for a specific package directly:
+
+```bash
+$ curl https://pkg.go.dev/v1beta/package/encoding/json
+```
+
+**JSON Response:**
+```json
+{
+ "modulePath": "std",
+ "version": "v1.26.3",
+ "isLatest": true,
+ "isStandardLibrary": true,
+ "goos": "all",
+ "goarch": "all",
+ "path": "encoding/json",
+ "name": "json",
+ "synopsis": "Package json implements encoding and decoding of JSON as defined in RFC 7159.",
+ "isRedistributable": true
+}
+```
+
+## The pkgsite-cli Reference Implementation
+
+To demonstrate how to interact with our API, we are providing a reference CLI implementation: `pkgsite-cli`. This implementation serves as a practical example for developers looking to build their own integrations, showing how to handle the data directly from the terminal. Please be aware that as the API continues to evolve, the interface and behavior of this CLI remain subject to adjustment.
+
+You can use it to search for packages, inspect symbols, and more without leaving your shell:
+
+```bash
+$ go install golang.org/x/pkgsite/cmd/internal/pkgsite-cli@latest
+
+$ pkgsite-cli search "http client"
+net/http
+ Module: s...@v1.26.3
+ Synopsis: Package http provides HTTP client and server implementations.
+... more
+
+$ pkgsite-cli package encoding/json
+encoding/json (standard library)
+ Name: json
+ Module: std
+ Version: v1.26.3 (latest)
+ Synopsis: Package json implements encoding and decoding of JSON as defined in RFC 7159.
+```
+
+The CLI handles pagination and formatting, allowing you to focus on the data you need for your scripts or manual investigation.To learn more, please visit pkgsite-cli’s documentation.
+
+## Stability and the Future
+
+This release establishes the initial foundation for our API. We are prioritizing stability for programmatic access, ensuring that tools built on top of this interface continue to work as [pkg.go.dev](https://pkg.go.dev) evolves. As we continue to refine this API, we welcome your feedback via our [issue tracker](https://github.com/golang/go/issues). We look forward to seeing the new tools and integrations the community will build.
\ No newline at end of file
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Draft CL taken directly from the doc, please feel free to review it in its final form and/or add other reviewers.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Since its inception, [pkg.go.dev](https://pkg.go.dev) has established itself as the primary resource for Go package documentation and discovery. While we initially prioritized creating a best-in-class web interface for users, the need for programmatic access has become increasingly clear. Developers building tools, IDE integrations, and automated workflows have historically relied on fragile workarounds like web scraping to access this data. To better address these evolving requirements, we are now expanding our platform to provide robust, direct access to the information our community needs.This phrase is overused by salespeople. Can we describe what makes it best in whatever class it inhabits?
Since its inception, [pkg.go.dev](https://pkg.go.dev) has established itself as the primary resource for Go package documentation and discovery. While we initially prioritized creating a best-in-class web interface for users, the need for programmatic access has become increasingly clear. Developers building tools, IDE integrations, and automated workflows have historically relied on fragile workarounds like web scraping to access this data. To better address these evolving requirements, we are now expanding our platform to provide robust, direct access to the information our community needs.primary for whom? Perhaps "the Go community's primary resource for package..."?
Today, we are excited to introduce the official [pkg.go.dev](https://pkg.go.dev) API - a stable interface for querying metadata about published Go modules. This launch is a direct response to years of community feedback. Furthermore, the need for a formalized interface has become even more acute with the rise of AI-assisted coding. Now there is the ability to access specific, high-fidelity context needed to reason about the Go ecosystem with significantly greater precision.service interface?
Today, we are excited to introduce the official [pkg.go.dev](https://pkg.go.dev) API - a stable interface for querying metadata about published Go modules. This launch is a direct response to years of community feedback. Furthermore, the need for a formalized interface has become even more acute with the rise of AI-assisted coding. Now there is the ability to access specific, high-fidelity context needed to reason about the Go ecosystem with significantly greater precision.This sentence could be tighter, and should use the active voice.
Today, we are excited to introduce the official [pkg.go.dev](https://pkg.go.dev) API - a stable interface for querying metadata about published Go modules. This launch is a direct response to years of community feedback. Furthermore, the need for a formalized interface has become even more acute with the rise of AI-assisted coding. Now there is the ability to access specific, high-fidelity context needed to reason about the Go ecosystem with significantly greater precision.An em dash (sans spaces) is appropriate here. Don't be afraid to use them just because the robot hacks overdo it!
* **Programmatic Search:** Tools can now find relevant packages based on keywords and receive structured JSON responses.Can this be a link to the actual JSON schema?
I notice that the schemas for the `package` and `module` JSON outputs are not the same as (or a superset of) the output of `go list -json` and `go list -m -json`. Is that intentional? (Feel free to direct me to the design docs rather than rehash the design here.)
```
$ go list -m -json go.starlark.net@latest
{
"Path": "go.starlark.net",
"Version": "v0.0.0-20260326113308-fadfc96def35",
"Query": "latest",
"Time": "2026-03-26T11:33:08Z",
"GoMod": "/Users/adonovan/go/pkg/mod/cache/download/go.starlark.net/@v/v0.0.0-20260326113308-fadfc96def35.mod",
"GoVersion": "1.25.0"
}
$ pkgsite-cli module -json go.starlark.net
{
"module": {
"path": "go.starlark.net",
"version": "v0.0.0-20260326113308-fadfc96def35",
"isLatest": true,
"isRedistributable": true,
"isStandardLibrary": false,
"hasGoMod": true,
"repoUrl": "https://github.com/google/starlark-go"
}
```
Might it be worth converging them while we still have the opportunity?
* **Programmatic Search:** Tools can now find relevant packages based on keywords and receive structured JSON responses.s
(capitalize only the first word)
* **AI and LLM Integration:** The API provides a way for large language models and agents to retrieve "just-in-time" context about Go packages, ensuring they utilize the latest library versions and documentation available in the registry.use
(utilize is almost never the right word)
* **AI and LLM Integration:** The API provides a way for large language models and agents to retrieve "just-in-time" context about Go packages, ensuring they utilize the latest library versions and documentation available in the registry.Let's avoid this word since Go modules don't aren't "registered": the index and proxy are merely a feed and cache of modules that have ever been downloaded by the go command.
## The Service InterfaceOonly the first word of each blog heading is typically capitalized.
Built for stability and efficient caching, the API utilizes a stateless, GET-only architecture. Primary endpoints are currently hosted under the `/v1beta` path. Following a period of community feedback and confirmed stability, we intend to transition toward a formal `v1` release.uses
One design principle for this API is **Precision over Convenience**. Unlike the Go command or [pkg.go.dev](https://pkg.go.dev) UI, which use "longest module path" shortcuts, the API requires explicit resolution. If a path is ambiguous, the API returns a list of candidates to force tools to be explicit about which dependency is being queried.I wonder why this ambiguity is important if the go command always consistently picks a specific resolution.
One design principle for this API is **Precision over Convenience**. Unlike the Go command or [pkg.go.dev](https://pkg.go.dev) UI, which use "longest module path" shortcuts, the API requires explicit resolution. If a path is ambiguous, the API returns a list of candidates to force tools to be explicit about which dependency is being queried.Use quotation marks, not capitals.
To demonstrate how to interact with our API, we are providing a reference CLI implementation: [pkgsite-cli](https://github.com/golang/pkgsite/tree/master/cmd/internal/pkgsite-cli). This implementation serves as a practical example for developers looking to build their own integrations, showing how to handle the data directly from the terminal. Please be aware that as the API continues to evolve, the interface and behavior of this CLI remain subject to adjustment.command
To demonstrate how to interact with our API, we are providing a reference CLI implementation: [pkgsite-cli](https://github.com/golang/pkgsite/tree/master/cmd/internal/pkgsite-cli). This implementation serves as a practical example for developers looking to build their own integrations, showing how to handle the data directly from the terminal. Please be aware that as the API continues to evolve, the interface and behavior of this CLI remain subject to adjustment.client
(CLI means "command-line interface", but here the role of the pkgsite-cli command is not as an interface--we explicitly disclaim its interface stability at the end of this paragraph0--but as a reference implementation of a client of the service.)
It would be nice to show a few more examples here.
BTW, I tried this command and got:
```
$ pkgsite-cli package --limit=99999 --imported-by go.starlark.net/starlark
go.starlark.net/starlark
Name: starlark
Module: go.starlark.net
Version: v0.0.0-20260326113308-fadfc96def35 (latest)
Imported by:
agola.io/agola/internal/config
...
Showing 1000 of 1209. Use --limit=N to see more.
```
Even with the limit flag, the result is still truncated. Is that a bug?
Also the -doc flag appears not to be working as documented:
```
$ pkgsite-cli package -help
...
Flags:
-doc string
render docs in format: text, md, html
...
$ pkgsite-cli package -doc=text go.starlark.net/starlark | head
go.starlark.net/starlark
Name: starlark
Module: go.starlark.net
Version: v0.0.0-20260326113308-fadfc96def35 (latest)
$ pkgsite-cli package -doc=nonesuch go.starlark.net/starlark | head
go.starlark.net/starlark
Name: starlark
Module: go.starlark.net
Version: v0.0.0-20260326113308-fadfc96def35 (latest)
```
Also -symbols:
```
$ pkgsite-cli package -symbols go.starlark.net/starlark
not found (HTTP 404)
```
The CLI handles pagination and formatting, allowing you to focus on the data you need for your scripts or manual investigation.To learn more, please visit [pkgsite-cli’s documentation](https://github.com/golang/pkgsite/blob/master/doc/pkgsite-cli.md).space after period
The CLI handles pagination and formatting, allowing you to focus on the data you need for your scripts or manual investigation.To learn more, please visit [pkgsite-cli’s documentation](https://github.com/golang/pkgsite/blob/master/doc/pkgsite-cli.md).command
This release establishes the initial foundation for our API. We are prioritizing stability for programmatic access, ensuring that tools built on top of this interface continue to work as [pkg.go.dev](https://pkg.go.dev) evolves. As we continue to refine this API, we welcome your feedback via our [issue tracker](https://github.com/golang/go/issues). We look forward to seeing the new tools and integrations the community will build.the service interface
This release establishes the initial foundation for our API. We are prioritizing stability for programmatic access, ensuring that tools built on top of this interface continue to work as [pkg.go.dev](https://pkg.go.dev) evolves. As we continue to refine this API, we welcome your feedback via our [issue tracker](https://github.com/golang/go/issues). We look forward to seeing the new tools and integrations the community will build.interface
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
One design principle for this API is **Precision over Convenience**. Unlike the Go command or [pkg.go.dev](https://pkg.go.dev) UI, which use "longest module path" shortcuts, the API requires explicit resolution. If a path is ambiguous, the API returns a list of candidates to force tools to be explicit about which dependency is being queried.I wonder why this ambiguity is important if the go command always consistently picks a specific resolution.
it's tru that `go get` from empty dependency always picks one, but other go commands can pick a different one with the same name depending on what's in go.mod.
e.g.
```
$ cat main.go
package main
import "github.com/hyangah/retracttest/d"
func main() {
println(d.D)
}
$ go get github.com/hyangah/retra...@v0.2.0
$ go mod tidy
$ go doc d.D
package d // import "github.com/hyangah/retracttest/d"var D = 1 // THIS IS ONE!!!
$ go get github.com/hyangah/retracttest@none
go: removed github.com/hyangah/retracttest v0.2.0
$ go mod tidy
go: finding module for package github.com/hyangah/retracttest/d
go: found github.com/hyangah/retracttest/d in github.com/hyangah/retracttest/d v0.2.0
$ go doc d.D
package d // import "github.com/hyangah/retracttest/d"
var D = 2 // THIS IS TWO!!!
```
pkg.go.dev decided to show the longest match.
The API instead chose to request the client to clarify which module path to use.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
Since its inception, [pkg.go.dev](https://pkg.go.dev) has established itself as the primary resource for Go package documentation and discovery. While we initially prioritized creating a best-in-class web interface for users, the need for programmatic access has become increasingly clear. Developers building tools, IDE integrations, and automated workflows have historically relied on fragile workarounds like web scraping to access this data. To better address these evolving requirements, we are now expanding our platform to provide robust, direct access to the information our community needs.This phrase is overused by salespeople. Can we describe what makes it best in whatever class it inhabits?
Done
Since its inception, [pkg.go.dev](https://pkg.go.dev) has established itself as the primary resource for Go package documentation and discovery. While we initially prioritized creating a best-in-class web interface for users, the need for programmatic access has become increasingly clear. Developers building tools, IDE integrations, and automated workflows have historically relied on fragile workarounds like web scraping to access this data. To better address these evolving requirements, we are now expanding our platform to provide robust, direct access to the information our community needs.primary for whom? Perhaps "the Go community's primary resource for package..."?
Done
Today, we are excited to introduce the official [pkg.go.dev](https://pkg.go.dev) API - a stable interface for querying metadata about published Go modules. This launch is a direct response to years of community feedback. Furthermore, the need for a formalized interface has become even more acute with the rise of AI-assisted coding. Now there is the ability to access specific, high-fidelity context needed to reason about the Go ecosystem with significantly greater precision.Ethan Leeservice interface?
Done
Today, we are excited to introduce the official [pkg.go.dev](https://pkg.go.dev) API - a stable interface for querying metadata about published Go modules. This launch is a direct response to years of community feedback. Furthermore, the need for a formalized interface has become even more acute with the rise of AI-assisted coding. Now there is the ability to access specific, high-fidelity context needed to reason about the Go ecosystem with significantly greater precision.An em dash (sans spaces) is appropriate here. Don't be afraid to use them just because the robot hacks overdo it!
Sure, but looks like
Today, we are excited to introduce the official [pkg.go.dev](https://pkg.go.dev) API - a stable interface for querying metadata about published Go modules. This launch is a direct response to years of community feedback. Furthermore, the need for a formalized interface has become even more acute with the rise of AI-assisted coding. Now there is the ability to access specific, high-fidelity context needed to reason about the Go ecosystem with significantly greater precision.This sentence could be tighter, and should use the active voice.
Done
* **Programmatic Search:** Tools can now find relevant packages based on keywords and receive structured JSON responses.s
(capitalize only the first word)
Done
* **AI and LLM Integration:** The API provides a way for large language models and agents to retrieve "just-in-time" context about Go packages, ensuring they utilize the latest library versions and documentation available in the registry.use
(utilize is almost never the right word)
Done
* **AI and LLM Integration:** The API provides a way for large language models and agents to retrieve "just-in-time" context about Go packages, ensuring they utilize the latest library versions and documentation available in the registry.Let's avoid this word since Go modules don't aren't "registered": the index and proxy are merely a feed and cache of modules that have ever been downloaded by the go command.
Done
Oonly the first word of each blog heading is typically capitalized.
Done
Built for stability and efficient caching, the API utilizes a stateless, GET-only architecture. Primary endpoints are currently hosted under the `/v1beta` path. Following a period of community feedback and confirmed stability, we intend to transition toward a formal `v1` release.Ethan Leeuses
Done
One design principle for this API is **Precision over Convenience**. Unlike the Go command or [pkg.go.dev](https://pkg.go.dev) UI, which use "longest module path" shortcuts, the API requires explicit resolution. If a path is ambiguous, the API returns a list of candidates to force tools to be explicit about which dependency is being queried.Use quotation marks, not capitals.
Done
To demonstrate how to interact with our API, we are providing a reference CLI implementation: [pkgsite-cli](https://github.com/golang/pkgsite/tree/master/cmd/internal/pkgsite-cli). This implementation serves as a practical example for developers looking to build their own integrations, showing how to handle the data directly from the terminal. Please be aware that as the API continues to evolve, the interface and behavior of this CLI remain subject to adjustment.Ethan Leecommand
Done
To demonstrate how to interact with our API, we are providing a reference CLI implementation: [pkgsite-cli](https://github.com/golang/pkgsite/tree/master/cmd/internal/pkgsite-cli). This implementation serves as a practical example for developers looking to build their own integrations, showing how to handle the data directly from the terminal. Please be aware that as the API continues to evolve, the interface and behavior of this CLI remain subject to adjustment.client
(CLI means "command-line interface", but here the role of the pkgsite-cli command is not as an interface--we explicitly disclaim its interface stability at the end of this paragraph0--but as a reference implementation of a client of the service.)
Done
The CLI handles pagination and formatting, allowing you to focus on the data you need for your scripts or manual investigation.To learn more, please visit [pkgsite-cli’s documentation](https://github.com/golang/pkgsite/blob/master/doc/pkgsite-cli.md).Ethan Leecommand
Done
The CLI handles pagination and formatting, allowing you to focus on the data you need for your scripts or manual investigation.To learn more, please visit [pkgsite-cli’s documentation](https://github.com/golang/pkgsite/blob/master/doc/pkgsite-cli.md).Ethan Leespace after period
Done
This release establishes the initial foundation for our API. We are prioritizing stability for programmatic access, ensuring that tools built on top of this interface continue to work as [pkg.go.dev](https://pkg.go.dev) evolves. As we continue to refine this API, we welcome your feedback via our [issue tracker](https://github.com/golang/go/issues). We look forward to seeing the new tools and integrations the community will build.Ethan Leeinterface
Done
This release establishes the initial foundation for our API. We are prioritizing stability for programmatic access, ensuring that tools built on top of this interface continue to work as [pkg.go.dev](https://pkg.go.dev) evolves. As we continue to refine this API, we welcome your feedback via our [issue tracker](https://github.com/golang/go/issues). We look forward to seeing the new tools and integrations the community will build.Ethan Leethe service interface
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
| Commit-Queue | +1 |
Today, we are excited to introduce the official [pkg.go.dev](https://pkg.go.dev) API - a stable interface for querying metadata about published Go modules. This launch is a direct response to years of community feedback. Furthermore, the need for a formalized interface has become even more acute with the rise of AI-assisted coding. Now there is the ability to access specific, high-fidelity context needed to reason about the Go ecosystem with significantly greater precision.An em dash (sans spaces) is appropriate here. Don't be afraid to use them just because the robot hacks overdo it!
Sure, but looks like
Done
Today, we are excited to introduce the official [pkg.go.dev](https://pkg.go.dev) API - a stable interface for querying metadata about published Go modules. This launch is a direct response to years of community feedback. Furthermore, the need for a formalized interface has become even more acute with the rise of AI-assisted coding. Now there is the ability to access specific, high-fidelity context needed to reason about the Go ecosystem with significantly greater precision.This sentence could be tighter, and should use the active voice.
Ethan LeeDone
Done
* **Programmatic Search:** Tools can now find relevant packages based on keywords and receive structured JSON responses.Can this be a link to the actual JSON schema?
I notice that the schemas for the `package` and `module` JSON outputs are not the same as (or a superset of) the output of `go list -json` and `go list -m -json`. Is that intentional? (Feel free to direct me to the design docs rather than rehash the design here.)
```
$ go list -m -json go.starlark.net@latest
{
"Path": "go.starlark.net",
"Version": "v0.0.0-20260326113308-fadfc96def35",
"Query": "latest",
"Time": "2026-03-26T11:33:08Z",
"GoMod": "/Users/adonovan/go/pkg/mod/cache/download/go.starlark.net/@v/v0.0.0-20260326113308-fadfc96def35.mod",
"GoVersion": "1.25.0"
}
$ pkgsite-cli module -json go.starlark.net
{
"module": {
"path": "go.starlark.net",
"version": "v0.0.0-20260326113308-fadfc96def35",
"isLatest": true,
"isRedistributable": true,
"isStandardLibrary": false,
"hasGoMod": true,
"repoUrl": "https://github.com/google/starlark-go"
}
```Might it be worth converging them while we still have the opportunity?
The schema for the API output was intentionally designed to reflect relevant data directly from the database, similar to the current operation of pkgsite. Because the API serves as a window into the global index rather than a local build tool, we prioritized mapping to the database structure for efficiency. Converging them would require either omitting database-specific fields or including data that go list doesn't provide.
Design doc link: go/pkgsite-rest-api
Thanks the first one was a bug, that I have a CL out for.
For the second one, it seems to be working:
```
$ pkgsite-cli package -doc=text go.starlark.net/starlark | head
go.starlark.net/starlark
Name: starlark
Module: go.starlark.net
Version: v0.0.0-20260326113308-fadfc96def35 (latest)
Synopsis: Package starlark provides a Starlark interpreter.
package starlark
Package starlark provides a Starlark interpreter.
$ pkgsite-cli package -doc=nonesuch go.starlark.net/starlark | head
bad doc format: need one of 'text', 'md', 'markdown' or 'html' (HTTP 400)
```
The third one resolves to this:
```
$ pkgsite-cli package -symbols go.starlark.net/starlark
go.starlark.net/starlark
Name: starlark
Module: go.starlark.net
Version: v0.0.0-20260326113308-fadfc96def35 (latest)
Synopsis: Package starlark provides a Starlark interpreter.
Symbols:
type Binding struct{ ... }
type Bool bool
type Builtin struct{}
type Bytes string
type CallFrame struct{ ... }
type CallStack []CallFrame
type Callable interface{ ... }
type Comparable interface{ ... }
type Container interface{ ... }
type DebugFrame interface{ ... }
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
One design principle for this API is **Precision over Convenience**. Unlike the Go command or [pkg.go.dev](https://pkg.go.dev) UI, which use "longest module path" shortcuts, the API requires explicit resolution. If a path is ambiguous, the API returns a list of candidates to force tools to be explicit about which dependency is being queried.The go command and pkg.go.dev are both user-facing tools that aim for a pleasant experience. Part of that is to streamline interactions by choosing sensible defaults. The API has a different goal: to provide comprehensive, accurate information about the Go ecosystem. For that task, it makes sense to require unambiguous queries.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Ah. It's not really a "shortcut" in the sense that it's by definition the canonical definition of the build semantics. Can we be more explicit about what we're being explicit about? Perhaps something along the lines of:
For example, the package imported as `example.com/a/b/c` could be provided by module `example.com/a` or by `example.com/a/b`. If both exist, the Go command the [pkg.go.dev](https://pkg.go.dev) web interface always choose the one with the longest possible module path. (This flexibility makes it possible to later "carve out" a submodule from an existing module without breaking builds.) However, the pkg.go.dev query interface will in this case return a list of candidates to force tools to be explicit about which dependency is being queried.
$ curl https://pkg.go.dev/v1beta/package/encoding/json | jqWhat is jq doing for us here? (Don't assume readers know what it is.)
```bash
$ pkgsite-cli search "http client"
```
**Command output:**
```textIs it necessary to add a separate block for the output? Using single block keeps related things together:
```
$ echo hello
hello
```
Thanks the first one was a bug, that I have a CL out for.
Good; let's make sure that fix is in the `latest` release before publishing the post.
For the second one, it seems to be working:
Still not working for me. In fact it is working even less than before:
```
tools$ pwd
/Users/adonovan/x/tools
tools$ go install golang.org/x/pkgsite/cmd/internal/pkgsite-cli@latest
tools$ pkgsite-cli package -doc=text go.starlark.net/starlark
HTTP 404: Not Found
```
The third is similarly not working.
$ pkgsite-cli package --imported-by encoding/jsonAll commands are failing for me:
```
$ pkgsite-cli package --imported-by encoding/json
HTTP 404: Not Found
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Of course, we want to release only once we have everything polished and production ready. I just sent out the blog post CL to gather feedback early (and it's been invaluable).
Regarding the 404 errors, that's expected, we pushed a new change and the deployments happen periodically. I will manually re-trigger the build and get back to you.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
Changed, it let me know what you think.
$ curl https://pkg.go.dev/v1beta/package/encoding/json | jqWhat is jq doing for us here? (Don't assume readers know what it is.)
Done
```bash
$ pkgsite-cli search "http client"
```
**Command output:**
```textIs it necessary to add a separate block for the output? Using single block keeps related things together:
```
$ echo hello
hello
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
* **Programmatic Search:** Tools can now find relevant packages based on keywords and receive structured JSON responses.Ethan LeeCan this be a link to the actual JSON schema?
I notice that the schemas for the `package` and `module` JSON outputs are not the same as (or a superset of) the output of `go list -json` and `go list -m -json`. Is that intentional? (Feel free to direct me to the design docs rather than rehash the design here.)
```
$ go list -m -json go.starlark.net@latest
{
"Path": "go.starlark.net",
"Version": "v0.0.0-20260326113308-fadfc96def35",
"Query": "latest",
"Time": "2026-03-26T11:33:08Z",
"GoMod": "/Users/adonovan/go/pkg/mod/cache/download/go.starlark.net/@v/v0.0.0-20260326113308-fadfc96def35.mod",
"GoVersion": "1.25.0"
}
$ pkgsite-cli module -json go.starlark.net
{
"module": {
"path": "go.starlark.net",
"version": "v0.0.0-20260326113308-fadfc96def35",
"isLatest": true,
"isRedistributable": true,
"isStandardLibrary": false,
"hasGoMod": true,
"repoUrl": "https://github.com/google/starlark-go"
}
```Might it be worth converging them while we still have the opportunity?
The schema for the API output was intentionally designed to reflect relevant data directly from the database, similar to the current operation of pkgsite. Because the API serves as a window into the global index rather than a local build tool, we prioritized mapping to the database structure for efficiency. Converging them would require either omitting database-specific fields or including data that go list doesn't provide.
Design doc link: go/pkgsite-rest-api
I see. Can we add a link from this section to the official schema description, wherever that is?
Is the issue that the request schema for the pkg.go.dev service requires the caller to provide a pair (module, pkgdir), whereas the web interface and the go command, by splitting a path using the "longest module" algorithm, do not?
I think it might be clearer to include the explanation in the parenthesis above as to why it is crucial that the go command and pkg.go.dev accept both forms: it's to support compatible evolution. Otherwise it raises the question of why the go command permits ambiguity, surely that's a bad thing?
$ curl https://pkg.go.dev/v1beta/package/encoding/json | jqI get a big HTML 404 page from this command.
Why is it reporting 404s at all, for commands that you already ran successfully (i.e. for server functionality that was already deployed)? That's a little strange.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
We changed the endpoint in a recent change, but then some other change broke the deployment. The root cause is known; the fix is in progress.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
+1 having actual docs that describe the api would be really useful, including all the optional query parameters.
| `/v1beta/module/{path}` | Information about the module at `{path}`. |somewhat unintuitively, it returns the response of the containing module if path is a package (e.g. golang.org/x/sync/errgroup)
This is different from go list -m which requires the argument be an actual module
| `/v1beta/packages/{path}` | Information about packages of the module at `{path}`. |same as above, it returns info for the module containing the package at path, rather than the module at the path, or a filtered view
| `/v1beta/symbols/{path}` | List of symbols declared by the package at `{path}`. |Symbols probably deserves an example, it's also unclear if / how to expand the response to include things like methods?
```
url -s https://pkg.go.dev/v1beta/symbols/golang.org/x/sync/singleflight | jq .
{
"modulePath": "golang.org/x/sync",
"version": "v0.20.0",
"symbols": {
"items": [
{
"name": "Group",
"kind": "Type",
"synopsis": "type Group struct{}",
"parent": "Group"
},
{
"name": "Result",
"kind": "Type",
"synopsis": "type Result struct{ ... }",
"parent": "Result"
}
],
"total": 2
}
}
```
| `/v1beta/package/{path}` | Information about the package at `{path}`. |
| `/v1beta/module/{path}` | Information about the module at `{path}`. |
| `/v1beta/versions/{path}` | Versions of the module at `{path}`. |
| `/v1beta/packages/{path}` | Information about packages of the module at `{path}`. |
| `/v1beta/search?q={query}` | Search results for a given query. |
| `/v1beta/symbols/{path}` | List of symbols declared by the package at `{path}`. |
| `/v1beta/imported-by/{path}` | Paths of packages importing the package at `{path}`. |
| `/v1beta/vulns/{path}` | Vulnerabilities of the module at `{path}`. |The immediate question i have is, where / how are versions specified?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Yeah I have added links in the `service interface` section to both pkg.go.dev/api and pkg.go.dev/v1beta/openapi.yaml.
| `/v1beta/module/{path}` | Information about the module at `{path}`. |somewhat unintuitively, it returns the response of the containing module if path is a package (e.g. golang.org/x/sync/errgroup)
This is different from go list -m which requires the argument be an actual module
Thanks, I think that's a good point and we are reconsidering the behavior if the path supplied is a package rather than a module. Will update this when that change lands.
| `/v1beta/symbols/{path}` | List of symbols declared by the package at `{path}`. |Symbols probably deserves an example, it's also unclear if / how to expand the response to include things like methods?
```
url -s https://pkg.go.dev/v1beta/symbols/golang.org/x/sync/singleflight | jq .
{
"modulePath": "golang.org/x/sync",
"version": "v0.20.0",
"symbols": {
"items": [
{
"name": "Group",
"kind": "Type",
"synopsis": "type Group struct{}",
"parent": "Group"
},
{
"name": "Result",
"kind": "Type",
"synopsis": "type Result struct{ ... }",
"parent": "Result"
}
],
"total": 2
}
}
```
That's a great point, I will add a relevant example. But first, I will change the way the symbols are returned and add filtering based on symbol kind.
| `/v1beta/package/{path}` | Information about the package at `{path}`. |
| `/v1beta/module/{path}` | Information about the module at `{path}`. |
| `/v1beta/versions/{path}` | Versions of the module at `{path}`. |
| `/v1beta/packages/{path}` | Information about packages of the module at `{path}`. |
| `/v1beta/search?q={query}` | Search results for a given query. |
| `/v1beta/symbols/{path}` | List of symbols declared by the package at `{path}`. |
| `/v1beta/imported-by/{path}` | Paths of packages importing the package at `{path}`. |
| `/v1beta/vulns/{path}` | Vulnerabilities of the module at `{path}`. |The immediate question i have is, where / how are versions specified?
That's a good point, I added some clarification for this!
I think that makes sense, I added the flexibility explanation to hopefully make clear that intention behind the design choice.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |