[pkgsite] cmd/internal/pkgsite-cli: copy API types using go generate

2 views
Skip to first unread message

Hyang-Ah Hana Kim (Gerrit)

unread,
Apr 21, 2026, 10:21:05 PM (7 days ago) Apr 21
to goph...@pubsubhelper.golang.org, Hyang-Ah Hana Kim, golang-co...@googlegroups.com

Hyang-Ah Hana Kim has uploaded the change for review

Commit message

cmd/internal/pkgsite-cli: copy API types using go generate

Copy the file to avoid dependency on api package.
This can be done by running the test here with -update flag.

For golang/go#78690
Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480

Change diff

diff --git a/cmd/internal/pkgsite-cli/client/client.go b/cmd/internal/pkgsite-cli/client/client.go
index 480d67a..f5a54e2 100644
--- a/cmd/internal/pkgsite-cli/client/client.go
+++ b/cmd/internal/pkgsite-cli/client/client.go
@@ -4,6 +4,8 @@

package client

+//go:generate go test -run=TestTypesUpToDate -update
+
import (
"context"
"encoding/json"
@@ -30,19 +32,7 @@
}
}

-// APIError is the error format returned by the v1 API.
-type APIError struct {
- Code int `json:"code"`
- Message string `json:"message"`
- Candidates []Candidate `json:"candidates,omitempty"`
-}
-
-type Candidate struct {
- ModulePath string `json:"modulePath"`
- PackagePath string `json:"packagePath"`
-}
-
-func (e *APIError) Error() string {
+func (e *Error) Error() string {
if len(e.Candidates) > 0 {
var b strings.Builder
fmt.Fprintf(&b, "%s; specify module path:\n", e.Message)
@@ -73,7 +63,7 @@
if err != nil {
return fmt.Errorf("reading error response: %w", err)
}
- var aerr APIError
+ var aerr Error
if json.Unmarshal(body, &aerr) == nil && aerr.Message != "" {
return &aerr
}
@@ -82,27 +72,6 @@
return json.NewDecoder(resp.Body).Decode(dst)
}

-// PackageResponse is the JSON response for /v1/package/.
-type PackageResponse struct {
- Path string `json:"path"`
- ModulePath string `json:"modulePath"`
- ModuleVersion string `json:"moduleVersion"`
- Synopsis string `json:"synopsis"`
- IsStandardLibrary bool `json:"isStandardLibrary"`
- IsLatest bool `json:"isLatest"`
- GOOS string `json:"goos"`
- GOARCH string `json:"goarch"`
- Docs string `json:"docs,omitempty"`
- Imports []string `json:"imports,omitempty"`
- Licenses []LicenseResponse `json:"licenses,omitempty"`
-}
-
-type LicenseResponse struct {
- Types []string `json:"types"`
- FilePath string `json:"filePath"`
- Contents string `json:"contents,omitempty"`
-}
-
// PackageOptions contains options for GetPackage.
type PackageOptions struct {
Module string
@@ -114,7 +83,7 @@
GOARCH string
}

-func (c *Client) GetPackage(ctx context.Context, path, version string, opts PackageOptions) (*PackageResponse, error) {
+func (c *Client) GetPackage(ctx context.Context, path, version string, opts PackageOptions) (*Package, error) {
q := make(url.Values)
if version != "" {
q.Set("version", version)
@@ -147,30 +116,13 @@
u = u.JoinPath("v1", "package", path)
u.RawQuery = q.Encode()

- var resp PackageResponse
+ var resp Package
if err := c.get(ctx, u.String(), &resp); err != nil {
return nil, err
}
return &resp, nil
}

-// PaginatedResponse is a generic paginated response.
-type PaginatedResponse[T any] struct {
- Items []T `json:"items"`
- Total int `json:"total"`
- NextPageToken string `json:"nextPageToken,omitempty"`
-}
-
-// SymbolResponse is a single symbol from /v1/symbols/.
-type SymbolResponse struct {
- ModulePath string `json:"modulePath"`
- Version string `json:"version"`
- Name string `json:"name"`
- Kind string `json:"kind"`
- Synopsis string `json:"synopsis"`
- Parent string `json:"parent,omitempty"`
-}
-
// PaginationOptions contains common pagination options.
type PaginationOptions struct {
Limit int
@@ -185,7 +137,7 @@
PaginationOptions
}

-func (c *Client) GetSymbols(ctx context.Context, path, version string, opts SymbolsOptions) (*PaginatedResponse[SymbolResponse], error) {
+func (c *Client) GetSymbols(ctx context.Context, path, version string, opts SymbolsOptions) (*PaginatedResponse[Symbol], error) {
q := make(url.Values)
if version != "" {
q.Set("version", version)
@@ -211,27 +163,20 @@
}
u = u.JoinPath("v1", "symbols", path)
u.RawQuery = q.Encode()
- var resp PaginatedResponse[SymbolResponse]
+ var resp PaginatedResponse[Symbol]
if err := c.get(ctx, u.String(), &resp); err != nil {
return nil, err
}
return &resp, nil
}

-// ImportedByResponse is the response for /v1/imported-by/.
-type ImportedByResponse struct {
- ModulePath string `json:"modulePath"`
- Version string `json:"version"`
- ImportedBy PaginatedResponse[string] `json:"importedBy"`
-}
-
// ImportedByOptions contains options for GetImportedBy.
type ImportedByOptions struct {
Module string
PaginationOptions
}

-func (c *Client) GetImportedBy(ctx context.Context, path, version string, opts ImportedByOptions) (*ImportedByResponse, error) {
+func (c *Client) GetImportedBy(ctx context.Context, path, version string, opts ImportedByOptions) (*PackageImportedBy, error) {
q := make(url.Values)
if version != "" {
q.Set("version", version)
@@ -251,38 +196,20 @@
}
u = u.JoinPath("v1", "imported-by", path)
u.RawQuery = q.Encode()
- var resp ImportedByResponse
+ var resp PackageImportedBy
if err := c.get(ctx, u.String(), &resp); err != nil {
return nil, err
}
return &resp, nil
}

-// ModuleResponse is the JSON response for /v1/module/.
-type ModuleResponse struct {
- Path string `json:"path"`
- Version string `json:"version"`
- IsLatest bool `json:"isLatest"`
- IsRedistributable bool `json:"isRedistributable"`
- IsStandardLibrary bool `json:"isStandardLibrary"`
- HasGoMod bool `json:"hasGoMod"`
- RepoURL string `json:"repoUrl"`
- Readme *ReadmeResponse `json:"readme,omitempty"`
- Licenses []LicenseResponse `json:"licenses,omitempty"`
-}
-
-type ReadmeResponse struct {
- Filepath string `json:"filepath"`
- Contents string `json:"contents"`
-}
-
// ModuleOptions contains options for GetModule.
type ModuleOptions struct {
Readme bool
Licenses bool
}

-func (c *Client) GetModule(ctx context.Context, path, version string, opts ModuleOptions) (*ModuleResponse, error) {
+func (c *Client) GetModule(ctx context.Context, path, version string, opts ModuleOptions) (*Module, error) {
q := make(url.Values)
if version != "" {
q.Set("version", version)
@@ -299,7 +226,7 @@
}
u = u.JoinPath("v1", "module", path)
u.RawQuery = q.Encode()
- var resp ModuleResponse
+ var resp Module
if err := c.get(ctx, u.String(), &resp); err != nil {
return nil, err
}
@@ -332,15 +259,7 @@
return &resp, nil
}

-// VulnResponse is a single vulnerability from /v1/vulns/.
-type VulnResponse struct {
- ID string `json:"id"`
- Summary string `json:"summary"`
- Details string `json:"details"`
- FixedVersion string `json:"fixedVersion"`
-}
-
-func (c *Client) GetVulns(ctx context.Context, path, version string, opts PaginationOptions) (*PaginatedResponse[VulnResponse], error) {
+func (c *Client) GetVulns(ctx context.Context, path, version string, opts PaginationOptions) (*PaginatedResponse[Vulnerability], error) {
q := make(url.Values)
if version != "" {
q.Set("version", version)
@@ -357,7 +276,7 @@
}
u = u.JoinPath("v1", "vulns", path)
u.RawQuery = q.Encode()
- var resp PaginatedResponse[VulnResponse]
+ var resp PaginatedResponse[Vulnerability]
if err := c.get(ctx, u.String(), &resp); err != nil {
return nil, err
}
@@ -394,21 +313,13 @@
return &resp, nil
}

-// SearchResultResponse is a single search result from /v1/search/.
-type SearchResultResponse struct {
- PackagePath string `json:"packagePath"`
- ModulePath string `json:"modulePath"`
- Version string `json:"version"`
- Synopsis string `json:"synopsis"`
-}
-
// SearchOptions contains options for Search.
type SearchOptions struct {
Symbol string
PaginationOptions
}

-func (c *Client) Search(ctx context.Context, query string, opts SearchOptions) (*PaginatedResponse[SearchResultResponse], error) {
+func (c *Client) Search(ctx context.Context, query string, opts SearchOptions) (*PaginatedResponse[SearchResult], error) {
q := make(url.Values)
q.Set("q", query)
if opts.Symbol != "" {
@@ -426,7 +337,7 @@
}
u = u.JoinPath("v1", "search")
u.RawQuery = q.Encode()
- var resp PaginatedResponse[SearchResultResponse]
+ var resp PaginatedResponse[SearchResult]
if err := c.get(ctx, u.String(), &resp); err != nil {
return nil, err
}
diff --git a/cmd/internal/pkgsite-cli/client/client_test.go b/cmd/internal/pkgsite-cli/client/client_test.go
index 5cfd2c7..43871b3 100644
--- a/cmd/internal/pkgsite-cli/client/client_test.go
+++ b/cmd/internal/pkgsite-cli/client/client_test.go
@@ -24,7 +24,7 @@
if got := r.URL.Query().Get("version"); got != "go1.26.0" {
t.Errorf("version = %q, want go1.26.0", got)
}
- json.NewEncoder(w).Encode(PackageResponse{
+ json.NewEncoder(w).Encode(Package{
Path: "encoding/json",
ModulePath: "std",
ModuleVersion: "go1.26.0",
@@ -62,7 +62,7 @@
if got := q.Get("module"); got != "github.com/foo/bar" {
t.Errorf("module = %q, want github.com/foo/bar", got)
}
- json.NewEncoder(w).Encode(PackageResponse{
+ json.NewEncoder(w).Encode(Package{
Path: "github.com/foo/bar/pkg",
Docs: "# package pkg",
Imports: []string{"fmt", "strings"},
@@ -93,7 +93,7 @@
if r.URL.Path != "/v1/module/golang.org/x/text" {
t.Errorf("path = %q, want /v1/module/golang.org/x/text", r.URL.Path)
}
- json.NewEncoder(w).Encode(ModuleResponse{
+ json.NewEncoder(w).Encode(Module{
Path: "golang.org/x/text",
Version: "v0.14.0",
RepoURL: "https://github.com/golang/text",
@@ -135,8 +135,8 @@

func TestGetVulns(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- json.NewEncoder(w).Encode(PaginatedResponse[VulnResponse]{
- Items: []VulnResponse{{ID: "GO-2023-0001", Details: "A vulnerability."}},
+ json.NewEncoder(w).Encode(PaginatedResponse[Vulnerability]{
+ Items: []Vulnerability{{ID: "GO-2023-0001", Details: "A vulnerability."}},
Total: 1,
})
}))
@@ -160,8 +160,8 @@
if got := r.URL.Query().Get("q"); got != "json parser" {
t.Errorf("q = %q, want %q", got, "json parser")
}
- json.NewEncoder(w).Encode(PaginatedResponse[SearchResultResponse]{
- Items: []SearchResultResponse{{
+ json.NewEncoder(w).Encode(PaginatedResponse[SearchResult]{
+ Items: []SearchResult{{
PackagePath: "encoding/json",
ModulePath: "std",
Version: "go1.26.0",
@@ -184,8 +184,8 @@

func TestGetSymbols(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- json.NewEncoder(w).Encode(PaginatedResponse[SymbolResponse]{
- Items: []SymbolResponse{{
+ json.NewEncoder(w).Encode(PaginatedResponse[Symbol]{
+ Items: []Symbol{{
Name: "Marshal",
Kind: "func",
Synopsis: "func Marshal(v any) ([]byte, error)",
@@ -207,7 +207,7 @@

func TestGetImportedBy(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- json.NewEncoder(w).Encode(ImportedByResponse{
+ json.NewEncoder(w).Encode(PackageImportedBy{
ModulePath: "std",
Version: "go1.26.0",
ImportedBy: PaginatedResponse[string]{
@@ -231,7 +231,7 @@
func TestAmbiguousPackagePath(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusBadRequest)
- json.NewEncoder(w).Encode(APIError{
+ json.NewEncoder(w).Encode(Error{
Code: 400,
Message: "ambiguous package path",
Candidates: []Candidate{
@@ -259,7 +259,7 @@
func TestAPIError(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
- json.NewEncoder(w).Encode(APIError{Code: 404, Message: "not found"})
+ json.NewEncoder(w).Encode(Error{Code: 404, Message: "not found"})
}))
defer srv.Close()

@@ -268,9 +268,9 @@
if err == nil {
t.Fatal("expected error")
}
- aerr, ok := err.(*APIError)
+ aerr, ok := err.(*Error)
if !ok {
- t.Fatalf("error type = %T, want *APIError", err)
+ t.Fatalf("error type = %T, want *Error", err)
}
if aerr.Code != 404 {
t.Errorf("Code = %d, want 404", aerr.Code)
diff --git a/cmd/internal/pkgsite-cli/client/types_gen.go b/cmd/internal/pkgsite-cli/client/types_gen.go
new file mode 100644
index 0000000..dc6d4f3
--- /dev/null
+++ b/cmd/internal/pkgsite-cli/client/types_gen.go
@@ -0,0 +1,100 @@
+// Code generated by types_test.go. DO NOT EDIT.
+
+package client
+
+// Package is the response for /v1/package/{packagePath}.
+type Package struct {
+ Path string `json:"path"`
+ ModulePath string `json:"modulePath"`
+ ModuleVersion string `json:"moduleVersion"`
+ Synopsis string `json:"synopsis"`
+ IsStandardLibrary bool `json:"isStandardLibrary"`
+ IsLatest bool `json:"isLatest"`
+ GOOS string `json:"goos"`
+ GOARCH string `json:"goarch"`
+ Docs string `json:"docs,omitempty"`
+ Imports []string `json:"imports,omitempty"`
+ Licenses []License `json:"licenses,omitempty"`
+}
+
+// License is license information in API responses.
+type License struct {
+ Types []string `json:"types"`
+ FilePath string `json:"filePath"`
+ Contents string `json:"contents,omitempty"`
+}
+
+// PaginatedResponse is a generic paginated response.
+type PaginatedResponse[T any] struct {
+ Items []T `json:"items"`
+ Total int `json:"total"`
+ NextPageToken string `json:"nextPageToken,omitempty"`
+}
+
+// PackageImportedBy is the response for /v1/imported-by/{packagePath}.
+type PackageImportedBy struct {
+ ModulePath string `json:"modulePath"`
+ Version string `json:"version"`
+ ImportedBy PaginatedResponse[string] `json:"importedBy"`
+}
+
+// Module is the response for /v1/module/{modulePath}.
+type Module struct {
+ Path string `json:"path"`
+ Version string `json:"version"`
+ IsLatest bool `json:"isLatest"`
+ IsRedistributable bool `json:"isRedistributable"`
+ IsStandardLibrary bool `json:"isStandardLibrary"`
+ HasGoMod bool `json:"hasGoMod"`
+ RepoURL string `json:"repoUrl"`
+ GoModContents string `json:"goModContents,omitempty"`
+ Readme *Readme `json:"readme,omitempty"`
+ Licenses []License `json:"licenses,omitempty"`
+}
+
+// Readme is a readme file.
+type Readme struct {
+ Filepath string `json:"filepath"`
+ Contents string `json:"contents"`
+}
+
+// Symbol is a symbol in /v1/symbols/{packagePath}.
+type Symbol struct {
+ ModulePath string `json:"modulePath"`
+ Version string `json:"version"`
+ Name string `json:"name"`
+ Kind string `json:"kind"`
+ Synopsis string `json:"synopsis"`
+ Parent string `json:"parent,omitempty"`
+}
+
+// SearchResults is the response for /v1/search?q={query}.
+type SearchResult struct {
+ PackagePath string `json:"packagePath"`
+ ModulePath string `json:"modulePath"`
+ Version string `json:"version"`
+ Synopsis string `json:"synopsis"`
+}
+
+// Vulnerability is a vulnerability in /v1/vulnerabilities/{modulePath}.
+type Vulnerability struct {
+ ID string `json:"id"`
+ Summary string `json:"summary"`
+ Details string `json:"details"`
+ FixedVersion string `json:"fixedVersion"`
+}
+
+// Error contains detailed information about an error.
+type Error struct {
+ Code int `json:"code"`
+ Message string `json:"message"`
+ Candidates []Candidate `json:"candidates,omitempty"`
+
+ err error // Unexported field for internal tracking
+}
+
+// Candidate is a potential resolution for an ambiguous path.
+type Candidate struct {
+ ModulePath string `json:"modulePath"`
+ PackagePath string `json:"packagePath"`
+}
diff --git a/cmd/internal/pkgsite-cli/client/types_test.go b/cmd/internal/pkgsite-cli/client/types_test.go
new file mode 100644
index 0000000..d562882
--- /dev/null
+++ b/cmd/internal/pkgsite-cli/client/types_test.go
@@ -0,0 +1,80 @@
+// Copyright 2026 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package client
+
+import (
+ "bytes"
+ "flag"
+ "go/ast"
+ "go/format"
+ "go/parser"
+ "go/printer"
+ "go/token"
+ "os"
+ "testing"
+)
+
+var update = flag.Bool("update", false, "update generated files")
+
+func TestTypesUpToDate(t *testing.T) {
+ srcPath := "../../../../internal/api/types.go"
+ genPath := "types_gen.go"
+
+ fset := token.NewFileSet()
+ node, err := parser.ParseFile(fset, srcPath, nil, parser.ParseComments)
+ if err != nil {
+ t.Fatalf("Failed to parse %s: %v", srcPath, err)
+ }
+
+ var buf bytes.Buffer
+ buf.WriteString("// Code generated by types_test.go. DO NOT EDIT.\n\n\n")
+ buf.WriteString("package client\n\n")
+
+ for _, decl := range node.Decls {
+ genDecl, ok := decl.(*ast.GenDecl)
+ if !ok || genDecl.Tok != token.TYPE {
+ continue
+ }
+ if len(genDecl.Specs) != 1 {
+ continue
+ }
+ spec := genDecl.Specs[0]
+ typeSpec, ok := spec.(*ast.TypeSpec)
+ if !ok {
+ continue
+ }
+ if _, ok := typeSpec.Type.(*ast.StructType); !ok {
+ continue
+ }
+
+ var specBuf bytes.Buffer
+ if err := printer.Fprint(&specBuf, fset, genDecl); err != nil {
+ t.Fatalf("Failed to print decl: %v", err)
+ }
+ buf.WriteString(specBuf.String())
+ buf.WriteString("\n\n")
+ }
+
+ expected, err := format.Source(buf.Bytes())
+ if err != nil {
+ t.Fatalf("Failed to format generated source: %v", err)
+ }
+
+ if *update {
+ if err := os.WriteFile(genPath, expected, 0644); err != nil {
+ t.Fatalf("Failed to write %s: %v", genPath, err)
+ }
+ return
+ }
+
+ actual, err := os.ReadFile(genPath)
+ if err != nil {
+ t.Fatalf("Failed to read %s: %v", genPath, err)
+ }
+
+ if !bytes.Equal(expected, actual) {
+ t.Errorf("%s is out of date. Run `go generate` in this directory to update it.", genPath)
+ }
+}
diff --git a/cmd/internal/pkgsite-cli/format.go b/cmd/internal/pkgsite-cli/format.go
index e424cfa..491df31 100644
--- a/cmd/internal/pkgsite-cli/format.go
+++ b/cmd/internal/pkgsite-cli/format.go
@@ -16,15 +16,15 @@
// These are used for both text formatting and JSON output.

type packageResult struct {
- Package *client.PackageResponse `json:"package"`
- Symbols *client.PaginatedResponse[client.SymbolResponse] `json:"symbols,omitempty"`
- ImportedBy *client.ImportedByResponse `json:"importedBy,omitempty"`
+ Package *client.Package `json:"package"`
+ Symbols *client.PaginatedResponse[client.Symbol] `json:"symbols,omitempty"`
+ ImportedBy *client.PackageImportedBy `json:"importedBy,omitempty"`
}

type moduleResult struct {
- Module *client.ModuleResponse `json:"module"`
+ Module *client.Module `json:"module"`
Versions *client.PaginatedResponse[client.VersionResponse] `json:"versions,omitempty"`
- Vulns *client.PaginatedResponse[client.VulnResponse] `json:"vulns,omitempty"`
+ Vulns *client.PaginatedResponse[client.Vulnerability] `json:"vulns,omitempty"`
Packages *client.PaginatedResponse[client.ModulePackageResponse] `json:"packages,omitempty"`
}

@@ -154,7 +154,7 @@
}
}

-func formatSearch(w io.Writer, r *client.PaginatedResponse[client.SearchResultResponse]) {
+func formatSearch(w io.Writer, r *client.PaginatedResponse[client.SearchResult]) {
if len(r.Items) == 0 {
fmt.Fprintln(w, "No results.")
return
@@ -170,7 +170,7 @@
formatPaginationHint(w, len(r.Items), r.Total)
}

-func formatLicenses(w io.Writer, licenses []client.LicenseResponse) {
+func formatLicenses(w io.Writer, licenses []client.License) {
fmt.Fprintln(w, "Licenses:")
for _, l := range licenses {
fmt.Fprintf(w, " %s (%s)\n", strings.Join(l.Types, ", "), l.FilePath)
diff --git a/cmd/internal/pkgsite-cli/format_test.go b/cmd/internal/pkgsite-cli/format_test.go
index 2caa73b..f734e9c 100644
--- a/cmd/internal/pkgsite-cli/format_test.go
+++ b/cmd/internal/pkgsite-cli/format_test.go
@@ -15,7 +15,7 @@
func TestFormatPackage(t *testing.T) {
var buf bytes.Buffer
formatPackage(&buf, packageResult{
- Package: &client.PackageResponse{
+ Package: &client.Package{
Path: "encoding/json",
ModulePath: "std",
ModuleVersion: "go1.22.0",
@@ -40,20 +40,20 @@
func TestFormatPackageWithExtras(t *testing.T) {
var buf bytes.Buffer
formatPackage(&buf, packageResult{
- Package: &client.PackageResponse{
+ Package: &client.Package{
Path: "github.com/foo/bar",
ModulePath: "github.com/foo/bar",
ModuleVersion: "v1.0.0",
Imports: []string{"fmt", "strings"},
- Licenses: []client.LicenseResponse{{Types: []string{"MIT"}, FilePath: "LICENSE"}},
+ Licenses: []client.License{{Types: []string{"MIT"}, FilePath: "LICENSE"}},
},
- Symbols: &client.PaginatedResponse[client.SymbolResponse]{
- Items: []client.SymbolResponse{
+ Symbols: &client.PaginatedResponse[client.Symbol]{
+ Items: []client.Symbol{
{Name: "New", Kind: "func", Synopsis: "func New() *Bar"},
},
Total: 1,
},
- ImportedBy: &client.ImportedByResponse{
+ ImportedBy: &client.PackageImportedBy{
ImportedBy: client.PaginatedResponse[string]{
Items: []string{"github.com/baz/qux"},
Total: 100,
@@ -81,7 +81,7 @@
func TestFormatModule(t *testing.T) {
var buf bytes.Buffer
formatModule(&buf, moduleResult{
- Module: &client.ModuleResponse{
+ Module: &client.Module{
Path: "golang.org/x/text",
Version: "v0.14.0",
IsLatest: true,
@@ -107,17 +107,17 @@
func TestFormatModuleWithExtras(t *testing.T) {
var buf bytes.Buffer
formatModule(&buf, moduleResult{
- Module: &client.ModuleResponse{
+ Module: &client.Module{
Path: "golang.org/x/text",
Version: "v0.14.0",
- Readme: &client.ReadmeResponse{Filepath: "README.md", Contents: "# text"},
+ Readme: &client.Readme{Filepath: "README.md", Contents: "# text"},
},
Versions: &client.PaginatedResponse[client.VersionResponse]{
Items: []client.VersionResponse{{Version: "v0.14.0"}, {Version: "v0.13.0"}},
Total: 2,
},
- Vulns: &client.PaginatedResponse[client.VulnResponse]{
- Items: []client.VulnResponse{{ID: "GO-2023-0001", Summary: "Bad thing", FixedVersion: "v0.14.0"}},
+ Vulns: &client.PaginatedResponse[client.Vulnerability]{
+ Items: []client.Vulnerability{{ID: "GO-2023-0001", Summary: "Bad thing", FixedVersion: "v0.14.0"}},
Total: 1,
},
Packages: &client.PaginatedResponse[client.ModulePackageResponse]{
@@ -146,8 +146,8 @@

func TestFormatSearch(t *testing.T) {
var buf bytes.Buffer
- formatSearch(&buf, &client.PaginatedResponse[client.SearchResultResponse]{
- Items: []client.SearchResultResponse{{
+ formatSearch(&buf, &client.PaginatedResponse[client.SearchResult]{
+ Items: []client.SearchResult{{
PackagePath: "encoding/json",
ModulePath: "std",
Version: "go1.22.0",
@@ -166,7 +166,7 @@

func TestFormatSearchEmpty(t *testing.T) {
var buf bytes.Buffer
- formatSearch(&buf, &client.PaginatedResponse[client.SearchResultResponse]{})
+ formatSearch(&buf, &client.PaginatedResponse[client.SearchResult]{})
if !strings.Contains(buf.String(), "No results") {
t.Errorf("expected 'No results' message, got:\n%s", buf.String())
}
diff --git a/cmd/internal/pkgsite-cli/main.go b/cmd/internal/pkgsite-cli/main.go
index 0817f68..aa230a7 100644
--- a/cmd/internal/pkgsite-cli/main.go
+++ b/cmd/internal/pkgsite-cli/main.go
@@ -98,9 +98,9 @@
// goes to stderr.
func handleErr(stdout, stderr io.Writer, err error, jsonMode bool) int {
if jsonMode {
- aerr, ok := err.(*client.APIError)
+ aerr, ok := err.(*client.Error)
if !ok {
- aerr = &client.APIError{Code: 1, Message: err.Error()}
+ aerr = &client.Error{Code: 1, Message: err.Error()}
}
writeJSON(stdout, stderr, aerr)
return 1
diff --git a/cmd/internal/pkgsite-cli/main_test.go b/cmd/internal/pkgsite-cli/main_test.go
index 1c35e84..e76bde4 100644
--- a/cmd/internal/pkgsite-cli/main_test.go
+++ b/cmd/internal/pkgsite-cli/main_test.go
@@ -70,7 +70,7 @@

func TestRunPackage(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- json.NewEncoder(w).Encode(client.PackageResponse{
+ json.NewEncoder(w).Encode(client.Package{
Path: "encoding/json",
ModulePath: "std",
ModuleVersion: "go1.22.0",
@@ -93,7 +93,7 @@

func TestRunPackageJSON(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- json.NewEncoder(w).Encode(client.PackageResponse{
+ json.NewEncoder(w).Encode(client.Package{
Path: "encoding/json",
ModulePath: "std",
})
@@ -116,7 +116,7 @@

func TestRunModule(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- json.NewEncoder(w).Encode(client.ModuleResponse{
+ json.NewEncoder(w).Encode(client.Module{
Path: "golang.org/x/text",
Version: "v0.14.0",
IsLatest: true,
@@ -141,8 +141,8 @@

func TestRunSearch(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- json.NewEncoder(w).Encode(client.PaginatedResponse[client.SearchResultResponse]{
- Items: []client.SearchResultResponse{{
+ json.NewEncoder(w).Encode(client.PaginatedResponse[client.SearchResult]{
+ Items: []client.SearchResult{{
PackagePath: "encoding/json",
ModulePath: "std",
Version: "go1.22.0",
@@ -165,7 +165,7 @@
func TestRunAPIError(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
- json.NewEncoder(w).Encode(client.APIError{Code: 404, Message: "not found"})
+ json.NewEncoder(w).Encode(client.Error{Code: 404, Message: "not found"})
}))
defer srv.Close()

@@ -182,7 +182,7 @@
func TestRunAPIErrorJSON(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
- json.NewEncoder(w).Encode(client.APIError{Code: 404, Message: "not found"})
+ json.NewEncoder(w).Encode(client.Error{Code: 404, Message: "not found"})
}))
defer srv.Close()

@@ -206,12 +206,12 @@
Total: 2,
})
case strings.HasPrefix(r.URL.Path, "/v1/vulns/"):
- json.NewEncoder(w).Encode(client.PaginatedResponse[client.VulnResponse]{
- Items: []client.VulnResponse{{ID: "GO-2023-0001", Summary: "Bad thing"}},
+ json.NewEncoder(w).Encode(client.PaginatedResponse[client.Vulnerability]{
+ Items: []client.Vulnerability{{ID: "GO-2023-0001", Summary: "Bad thing"}},
Total: 1,
})
default:
- json.NewEncoder(w).Encode(client.ModuleResponse{
+ json.NewEncoder(w).Encode(client.Module{
Path: "golang.org/x/text",
Version: "v0.14.0",
})

Change information

Files:
  • M cmd/internal/pkgsite-cli/client/client.go
  • M cmd/internal/pkgsite-cli/client/client_test.go
  • A cmd/internal/pkgsite-cli/client/types_gen.go
  • A cmd/internal/pkgsite-cli/client/types_test.go
  • M cmd/internal/pkgsite-cli/format.go
  • M cmd/internal/pkgsite-cli/format_test.go
  • M cmd/internal/pkgsite-cli/main.go
  • M cmd/internal/pkgsite-cli/main_test.go
Change size: L
Delta: 8 files changed, 243 insertions(+), 152 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
  • requirement is not satisfiedkokoro-CI-Passes
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: pkgsite
Gerrit-Branch: master
Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
Gerrit-Change-Number: 769681
Gerrit-PatchSet: 1
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

kokoro (Gerrit)

unread,
Apr 21, 2026, 10:33:34 PM (7 days ago) Apr 21
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Hyang-Ah Hana Kim

kokoro voted kokoro-CI-1

Kokoro presubmit build finished with status: FAILURE
Logs at: https://source.cloud.google.com/results/invocations/a744f04d-29d6-4adf-941f-cbdc2d9ba616

kokoro-CI-1
Open in Gerrit

Related details

Attention is currently required from:
  • Hyang-Ah Hana Kim
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
  • requirement is not satisfiedkokoro-CI-Passes
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: pkgsite
Gerrit-Branch: master
Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
Gerrit-Change-Number: 769681
Gerrit-PatchSet: 1
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-CC: kokoro <noreply...@google.com>
Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Comment-Date: Wed, 22 Apr 2026 02:33:26 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Hyang-Ah Hana Kim (Gerrit)

unread,
Apr 27, 2026, 5:14:38 PM (2 days ago) Apr 27
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Hyang-Ah Hana Kim

Hyang-Ah Hana Kim uploaded new patchset

Hyang-Ah Hana Kim uploaded patch set #2 to this change.
Following approvals got outdated and were removed:
Open in Gerrit

Related details

Attention is currently required from:
  • Hyang-Ah Hana Kim
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
  • requirement is not satisfiedkokoro-CI-Passes
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: pkgsite
Gerrit-Branch: master
Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
Gerrit-Change-Number: 769681
Gerrit-PatchSet: 2
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

kokoro (Gerrit)

unread,
Apr 27, 2026, 5:24:54 PM (2 days ago) Apr 27
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Hyang-Ah Hana Kim

kokoro voted kokoro-CI-1

Kokoro presubmit build finished with status: FAILURE

Open in Gerrit

Related details

Attention is currently required from:
  • Hyang-Ah Hana Kim
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
  • requirement is not satisfiedkokoro-CI-Passes
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: pkgsite
Gerrit-Branch: master
Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
Gerrit-Change-Number: 769681
Gerrit-PatchSet: 2
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-CC: kokoro <noreply...@google.com>
Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Comment-Date: Mon, 27 Apr 2026 21:24:50 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

kokoro (Gerrit)

unread,
Apr 27, 2026, 5:42:53 PM (2 days ago) Apr 27
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Hyang-Ah Hana Kim

kokoro voted kokoro-CI-1

Kokoro presubmit build finished with status: FAILURE

Open in Gerrit

Related details

Attention is currently required from:
  • Hyang-Ah Hana Kim
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
  • requirement is not satisfiedkokoro-CI-Passes
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: pkgsite
Gerrit-Branch: master
Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
Gerrit-Change-Number: 769681
Gerrit-PatchSet: 3
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-CC: kokoro <noreply...@google.com>
Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Comment-Date: Mon, 27 Apr 2026 21:42:48 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Hyang-Ah Hana Kim (Gerrit)

unread,
Apr 27, 2026, 6:32:33 PM (2 days ago) Apr 27
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Ethan Lee and Jonathan Amsterdam

Hyang-Ah Hana Kim uploaded new patchset

Hyang-Ah Hana Kim uploaded patch set #4 to this change.
Following approvals got outdated and were removed:
Open in Gerrit

Related details

Attention is currently required from:
  • Ethan Lee
  • Jonathan Amsterdam
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
  • requirement is not satisfiedkokoro-CI-Passes
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: pkgsite
Gerrit-Branch: master
Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
Gerrit-Change-Number: 769681
Gerrit-PatchSet: 4
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
Gerrit-Attention: Jonathan Amsterdam <j...@google.com>
Gerrit-Attention: Ethan Lee <etha...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

kokoro (Gerrit)

unread,
Apr 27, 2026, 6:58:16 PM (2 days ago) Apr 27
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Ethan Lee, Jonathan Amsterdam, golang-co...@googlegroups.com
Attention needed from Ethan Lee, Hyang-Ah Hana Kim and Jonathan Amsterdam

kokoro voted kokoro-CI+1

Kokoro presubmit build finished with status: SUCCESS
Logs at: https://source.cloud.google.com/results/invocations/8b877fd0-af93-4c8c-b403-fb6248a23d0e

kokoro-CI+1
Open in Gerrit

Related details

Attention is currently required from:
  • Ethan Lee
  • Hyang-Ah Hana Kim
  • Jonathan Amsterdam
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    • requirement satisfiedkokoro-CI-Passes
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: pkgsite
    Gerrit-Branch: master
    Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
    Gerrit-Change-Number: 769681
    Gerrit-PatchSet: 4
    Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Ethan Lee <etha...@google.com>
    Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
    Gerrit-Reviewer: kokoro <noreply...@google.com>
    Gerrit-CC: kokoro <noreply...@google.com>
    Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
    Gerrit-Attention: Jonathan Amsterdam <j...@google.com>
    Gerrit-Attention: Ethan Lee <etha...@google.com>
    Gerrit-Comment-Date: Mon, 27 Apr 2026 22:58:11 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Jonathan Amsterdam (Gerrit)

    unread,
    Apr 28, 2026, 12:25:29 PM (17 hours ago) Apr 28
    to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, kokoro, golang...@luci-project-accounts.iam.gserviceaccount.com, Ethan Lee, golang-co...@googlegroups.com
    Attention needed from Ethan Lee and Hyang-Ah Hana Kim

    Jonathan Amsterdam voted and added 1 comment

    Votes added by Jonathan Amsterdam

    Code-Review+1

    1 comment

    File cmd/internal/pkgsite-cli/client/types_test.go
    Line 1, Patchset 4 (Latest):// Copyright 2026 The Go Authors. All rights reserved.
    Jonathan Amsterdam . unresolved

    Document what this does.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ethan Lee
    • Hyang-Ah Hana Kim
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      • requirement satisfiedkokoro-CI-Passes
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: pkgsite
      Gerrit-Branch: master
      Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
      Gerrit-Change-Number: 769681
      Gerrit-PatchSet: 4
      Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
      Gerrit-Reviewer: Ethan Lee <etha...@google.com>
      Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
      Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
      Gerrit-Reviewer: kokoro <noreply...@google.com>
      Gerrit-CC: kokoro <noreply...@google.com>
      Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
      Gerrit-Attention: Ethan Lee <etha...@google.com>
      Gerrit-Comment-Date: Tue, 28 Apr 2026 16:25:24 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Ethan Lee (Gerrit)

      unread,
      Apr 28, 2026, 1:28:19 PM (16 hours ago) Apr 28
      to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, Jonathan Amsterdam, kokoro, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
      Attention needed from Hyang-Ah Hana Kim

      Ethan Lee voted Code-Review+2

      Code-Review+2
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Hyang-Ah Hana Kim
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      • requirement satisfiedkokoro-CI-Passes
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: pkgsite
      Gerrit-Branch: master
      Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
      Gerrit-Change-Number: 769681
      Gerrit-PatchSet: 4
      Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
      Gerrit-Reviewer: Ethan Lee <etha...@google.com>
      Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
      Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
      Gerrit-Reviewer: kokoro <noreply...@google.com>
      Gerrit-CC: kokoro <noreply...@google.com>
      Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
      Gerrit-Comment-Date: Tue, 28 Apr 2026 17:28:14 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Hyang-Ah Hana Kim (Gerrit)

      unread,
      Apr 28, 2026, 5:42:34 PM (12 hours ago) Apr 28
      to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Hyang-Ah Hana Kim

      Hyang-Ah Hana Kim uploaded new patchset

      Hyang-Ah Hana Kim uploaded patch set #5 to this change.
      Following approvals got outdated and were removed:
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Hyang-Ah Hana Kim
      Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        • requirement is not satisfiedkokoro-CI-Passes
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: newpatchset
        Gerrit-Project: pkgsite
        Gerrit-Branch: master
        Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
        Gerrit-Change-Number: 769681
        Gerrit-PatchSet: 5
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Hyang-Ah Hana Kim (Gerrit)

        unread,
        Apr 28, 2026, 5:43:06 PM (12 hours ago) Apr 28
        to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, Ethan Lee, Jonathan Amsterdam, kokoro, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
        Attention needed from Jonathan Amsterdam

        Hyang-Ah Hana Kim added 1 comment

        File cmd/internal/pkgsite-cli/client/types_test.go
        Line 1, Patchset 4:// Copyright 2026 The Go Authors. All rights reserved.
        Jonathan Amsterdam . resolved

        Document what this does.

        Hyang-Ah Hana Kim

        Done

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Jonathan Amsterdam
        Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        • requirement is not satisfiedkokoro-CI-Passes
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: pkgsite
        Gerrit-Branch: master
        Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
        Gerrit-Change-Number: 769681
        Gerrit-PatchSet: 5
        Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
        Gerrit-Reviewer: Ethan Lee <etha...@google.com>
        Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
        Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
        Gerrit-Reviewer: kokoro <noreply...@google.com>
        Gerrit-CC: kokoro <noreply...@google.com>
        Gerrit-Attention: Jonathan Amsterdam <j...@google.com>
        Gerrit-Comment-Date: Tue, 28 Apr 2026 21:43:01 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Jonathan Amsterdam <j...@google.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        kokoro (Gerrit)

        unread,
        Apr 28, 2026, 6:11:12 PM (11 hours ago) Apr 28
        to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Ethan Lee, Jonathan Amsterdam, golang-co...@googlegroups.com
        Attention needed from Hyang-Ah Hana Kim and Jonathan Amsterdam

        kokoro voted kokoro-CI+1

        Kokoro presubmit build finished with status: SUCCESS

        Attention is currently required from:
        • Hyang-Ah Hana Kim
        • Jonathan Amsterdam
        Submit Requirements:
          • requirement satisfiedCode-Review
          • requirement satisfiedNo-Unresolved-Comments
          • requirement satisfiedReview-Enforcement
          • requirement satisfiedTryBots-Pass
          • requirement satisfiedkokoro-CI-Passes
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: pkgsite
          Gerrit-Branch: master
          Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
          Gerrit-Change-Number: 769681
          Gerrit-PatchSet: 5
          Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
          Gerrit-Reviewer: Ethan Lee <etha...@google.com>
          Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
          Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
          Gerrit-Reviewer: kokoro <noreply...@google.com>
          Gerrit-CC: kokoro <noreply...@google.com>
          Gerrit-Attention: Hyang-Ah Hana Kim <hya...@gmail.com>
          Gerrit-Attention: Jonathan Amsterdam <j...@google.com>
          Gerrit-Comment-Date: Tue, 28 Apr 2026 22:11:01 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          open
          diffy

          Hyang-Ah Hana Kim (Gerrit)

          unread,
          Apr 28, 2026, 6:24:58 PM (11 hours ago) Apr 28
          to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, kokoro, golang...@luci-project-accounts.iam.gserviceaccount.com, Ethan Lee, Jonathan Amsterdam, golang-co...@googlegroups.com

          Hyang-Ah Hana Kim submitted the change with unreviewed changes

          Unreviewed changes

          4 is the latest approved patch-set.
          The change was submitted with unreviewed changes in the following files:

          ```
          The name of the file: cmd/internal/pkgsite-cli/client/types_test.go
          Insertions: 7, Deletions: 0.

          @@ -21,6 +21,13 @@


          var update = flag.Bool("update", false, "update generated files")

          +// TestTypesUpToDate verifies that types_gen.go is up to date with
          +// ../../../../internal/api/types.go.
          +// If run with the -update flag, it updates types_gen.go.
          +//
          +// This test effectively acts as a generator to copy API types from the
          +// internal/api package to avoid exposing internal packages or creating
          +// circular dependencies, while keeping them in sync.
          func TestTypesUpToDate(t *testing.T) {
          srcPath := "../../../../internal/api/types.go"
          genPath := "types_gen.go"
          ```

          Change information

          Commit message:
          cmd/internal/pkgsite-cli: copy API types using go generate

          Copy the file to avoid dependency on api package.
          This can be done by running the test here with -update flag.
          (or go generate)

          For golang/go#78690
          Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
          Reviewed-by: Jonathan Amsterdam <j...@google.com>
          Reviewed-by: Ethan Lee <etha...@google.com>
          kokoro-CI: kokoro <noreply...@google.com>
          Files:
          • M cmd/internal/pkgsite-cli/client/client.go
          • M cmd/internal/pkgsite-cli/client/client_test.go
          • A cmd/internal/pkgsite-cli/client/types_gen.go
          • A cmd/internal/pkgsite-cli/client/types_test.go
          • M cmd/internal/pkgsite-cli/format.go
          • M cmd/internal/pkgsite-cli/format_test.go
          • M cmd/internal/pkgsite-cli/main.go
          • M cmd/internal/pkgsite-cli/main_test.go
          Change size: L
          Delta: 8 files changed, 342 insertions(+), 152 deletions(-)
          Branch: refs/heads/master
          Submit Requirements:
          Open in Gerrit
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: merged
          Gerrit-Project: pkgsite
          Gerrit-Branch: master
          Gerrit-Change-Id: Ifa2106b0ad836ff11a90238bc7d784b8ed131480
          Gerrit-Change-Number: 769681
          Gerrit-PatchSet: 6
          open
          diffy
          satisfied_requirement
          Reply all
          Reply to author
          Forward
          0 new messages