[pkgsite] internal: instantiate v1/package/{path} endpoint

3 views
Skip to first unread message

Ethan Lee (Gerrit)

unread,
Mar 11, 2026, 3:19:55 PM (7 days ago) Mar 11
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Ethan Lee has uploaded the change for review

Commit message

internal: instantiate v1/package/{path} endpoint

- Create handler for serving v1 package endpoint.
- Create tests to verify endpoint behavior.
Change-Id: I72701cb15d83baf4e31ed918c198adf347605a4a

Change diff

diff --git a/internal/api/api.go b/internal/api/api.go
new file mode 100644
index 0000000..37645a3
--- /dev/null
+++ b/internal/api/api.go
@@ -0,0 +1,93 @@
+// 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 api
+
+import (
+ "encoding/json"
+ "errors"
+ "net/http"
+ "strings"
+
+ "golang.org/x/pkgsite/internal"
+ "golang.org/x/pkgsite/internal/derrors"
+ "golang.org/x/pkgsite/internal/stdlib"
+ "golang.org/x/pkgsite/internal/version"
+)
+
+// ServePackageV1 handles requests for the v1 package metadata endpoint.
+// It is intended to be wrapped by a server's error handler.
+func ServePackageV1(w http.ResponseWriter, r *http.Request, ds internal.DataSource) (err error) {
+ defer derrors.Wrap(&err, "ServePackageV1")
+
+ // The path is expected to be /v1/package/{path}
+ pkgPath := strings.TrimPrefix(r.URL.Path, "/v1/package/")
+ if pkgPath == "" {
+ return &apiError{status: http.StatusBadRequest, err: errors.New("missing package path")}
+ }
+
+ var params PackageParams
+ if err := ParseParams(r.URL.Query(), &params); err != nil {
+ return &apiError{status: http.StatusBadRequest, err: err}
+ }
+
+ requestedVersion := params.Version
+ if requestedVersion == "" {
+ requestedVersion = version.Latest
+ }
+
+ modulePath := params.Module
+ if modulePath == "" {
+ modulePath = internal.UnknownModulePath
+ }
+
+ um, err := ds.GetUnitMeta(r.Context(), pkgPath, modulePath, requestedVersion)
+ if err != nil {
+ if errors.Is(err, derrors.NotFound) {
+ return &apiError{status: http.StatusNotFound, err: err}
+ }
+ return err
+ }
+
+ // Use GetUnit to get the synopsis from documentation.
+ bc := internal.BuildContext{GOOS: params.GOOS, GOARCH: params.GOARCH}
+ unit, err := ds.GetUnit(r.Context(), um, internal.AllFields, bc)
+ if err != nil {
+ return err
+ }
+
+ synopsis := ""
+ if len(unit.Documentation) > 0 {
+ synopsis = unit.Documentation[0].Synopsis
+ }
+
+ resp := Package{
+ Path: unit.Path,
+ ModulePath: unit.ModulePath,
+ ModuleVersion: unit.Version,
+ Synopsis: synopsis,
+ IsStandardLibrary: stdlib.Contains(unit.ModulePath),
+ IsLatest: unit.Version == requestedVersion,
+ GOOS: params.GOOS,
+ GOARCH: params.GOARCH,
+ }
+
+ return serveJSON(w, http.StatusOK, resp)
+}
+
+func serveJSON(w http.ResponseWriter, status int, data any) error {
+ w.Header().Set("Content-Type", "application/json")
+ w.WriteHeader(status)
+ return json.NewEncoder(w).Encode(data)
+}
+
+// apiError is a local error type that can be used to signal HTTP status codes
+// if the caller's error handler supports it.
+type apiError struct {
+ status int
+ err error
+}
+
+func (e *apiError) Error() string { return e.err.Error() }
+func (e *apiError) StatusCode() int { return e.status }
diff --git a/internal/api/api_test.go b/internal/api/api_test.go
new file mode 100644
index 0000000..190f6ed
--- /dev/null
+++ b/internal/api/api_test.go
@@ -0,0 +1,117 @@
+// 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 api
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+
+ "github.com/google/go-cmp/cmp"
+ "golang.org/x/pkgsite/internal"
+ "golang.org/x/pkgsite/internal/testing/fakedatasource"
+)
+
+func TestServePackageV1(t *testing.T) {
+ ctx := context.Background()
+ ds := fakedatasource.New()
+
+ const (
+ pkgPath = "example.com/pkg"
+ modulePath = "example.com"
+ version = "v1.2.3"
+ )
+
+ ds.MustInsertModule(ctx, &internal.Module{
+ ModuleInfo: internal.ModuleInfo{
+ ModulePath: modulePath,
+ Version: version,
+ },
+ Units: []*internal.Unit{
+ {
+ UnitMeta: internal.UnitMeta{
+ Path: pkgPath,
+ ModuleInfo: internal.ModuleInfo{
+ ModulePath: modulePath,
+ Version: version,
+ },
+ Name: "pkg",
+ },
+ Documentation: []*internal.Documentation{
+ {
+ Synopsis: "This is a test package.",
+ },
+ },
+ },
+ },
+ })
+
+ for _, test := range []struct {
+ name string
+ url string
+ wantStatus int
+ want *Package
+ }{
+ {
+ name: "basic metadata",
+ url: "/v1/package/example.com/pkg?version=v1.2.3",
+ wantStatus: http.StatusOK,
+ want: &Package{
+ Path: pkgPath,
+ ModulePath: modulePath,
+ ModuleVersion: version,
+ Synopsis: "This is a test package.",
+ },
+ },
+ {
+ name: "not found",
+ url: "/v1/package/example.com/nonexistent",
+ wantStatus: http.StatusNotFound,
+ },
+ {
+ name: "missing path",
+ url: "/v1/package/",
+ wantStatus: http.StatusBadRequest,
+ },
+ } {
+ t.Run(test.name, func(t *testing.T) {
+ r := httptest.NewRequest("GET", test.url, nil)
+ w := httptest.NewRecorder()
+
+ err := ServePackageV1(w, r, ds)
+
+ // If it's an apiError, check the status
+ if err != nil {
+ var aerr *apiError
+ if errors.As(err, &aerr) {
+ if aerr.status != test.wantStatus {
+ t.Errorf("status = %d, want %d", aerr.status, test.wantStatus)
+ }
+ } else {
+ t.Fatalf("unexpected error: %v", err)
+ }
+ return
+ }
+
+ if w.Code != test.wantStatus {
+ t.Errorf("status = %d, want %d", w.Code, test.wantStatus)
+ }
+ if test.want != nil {
+ var got Package
+ if err := json.Unmarshal(w.Body.Bytes(), &got); err != nil {
+ t.Fatalf("json.Unmarshal: %v", err)
+ }
+ // Clear fields we don't strictly test here or that might be dynamic
+ got.IsLatest = false
+ if diff := cmp.Diff(test.want, &got); diff != "" {
+ t.Errorf("mismatch (-want +got):\n%s", diff)
+ }
+ }
+ })
+ }
+}
diff --git a/internal/frontend/server.go b/internal/frontend/server.go
index 5a55463..a03e45c 100644
--- a/internal/frontend/server.go
+++ b/internal/frontend/server.go
@@ -235,7 +235,9 @@
handle("GET /golang.org/x", s.staticPageHandler("subrepo", "Sub-repositories"))
handle("GET /files/", http.StripPrefix("/files", s.fileMux))
handle("GET /vuln/", vulnHandler)
+ handle("GET /v1/package/", s.errorHandler(api.ServePackageV1))
handle("/opensearch.xml", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+
serveFileFS(w, r, s.staticFS, "shared/opensearch.xml")
}))
handle("/", detailHandler)

Change information

Files:
  • A internal/api/api.go
  • A internal/api/api_test.go
  • M internal/frontend/server.go
Change size: M
Delta: 3 files changed, 212 insertions(+), 0 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: I72701cb15d83baf4e31ed918c198adf347605a4a
Gerrit-Change-Number: 754420
Gerrit-PatchSet: 1
Gerrit-Owner: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

kokoro (Gerrit)

unread,
Mar 11, 2026, 3:30:34 PM (7 days ago) Mar 11
to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
Attention needed from Ethan Lee

kokoro voted kokoro-CI-1

Kokoro presubmit build finished with status: FAILURE
Logs at: https://source.cloud.google.com/results/invocations/46da591b-a33f-4977-8a10-b8012ac26db9

kokoro-CI-1
Open in Gerrit

Related details

Attention is currently required from:
  • Ethan Lee
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: I72701cb15d83baf4e31ed918c198adf347605a4a
Gerrit-Change-Number: 754420
Gerrit-PatchSet: 1
Gerrit-Owner: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-CC: kokoro <noreply...@google.com>
Gerrit-Attention: Ethan Lee <etha...@google.com>
Gerrit-Comment-Date: Wed, 11 Mar 2026 19:30:28 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Ethan Lee (Gerrit)

unread,
Mar 11, 2026, 4:38:37 PM (7 days ago) Mar 11
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Ethan Lee

Ethan Lee uploaded new patchset

Ethan Lee uploaded patch set #2 to this change.
Following approvals got outdated and were removed:
  • TryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI
  • kokoro-CI-Passes: kokoro-CI-1 by kokoro
Open in Gerrit

Related details

Attention is currently required from:
  • Ethan Lee
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: I72701cb15d83baf4e31ed918c198adf347605a4a
Gerrit-Change-Number: 754420
Gerrit-PatchSet: 2
unsatisfied_requirement
satisfied_requirement
open
diffy

kokoro (Gerrit)

unread,
Mar 11, 2026, 4:47:46 PM (7 days ago) Mar 11
to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
Attention needed from Ethan Lee

kokoro voted kokoro-CI-1

Kokoro presubmit build finished with status: FAILURE

Open in Gerrit

Related details

Attention is currently required from:
  • Ethan Lee
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: I72701cb15d83baf4e31ed918c198adf347605a4a
Gerrit-Change-Number: 754420
Gerrit-PatchSet: 2
Gerrit-Owner: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-CC: kokoro <noreply...@google.com>
Gerrit-Attention: Ethan Lee <etha...@google.com>
Gerrit-Comment-Date: Wed, 11 Mar 2026 20:47:43 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

kokoro (Gerrit)

unread,
Mar 11, 2026, 4:51:18 PM (7 days ago) Mar 11
to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
Attention needed from Ethan Lee

kokoro voted kokoro-CI-1

Kokoro presubmit build finished with status: FAILURE

Open in Gerrit

Related details

Attention is currently required from:
  • Ethan Lee
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: I72701cb15d83baf4e31ed918c198adf347605a4a
Gerrit-Change-Number: 754420
Gerrit-PatchSet: 3
Gerrit-Owner: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-CC: kokoro <noreply...@google.com>
Gerrit-Attention: Ethan Lee <etha...@google.com>
Gerrit-Comment-Date: Wed, 11 Mar 2026 20:51:14 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Ethan Lee (Gerrit)

unread,
Mar 13, 2026, 12:38:23 PM (5 days ago) Mar 13
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Ethan Lee

Ethan Lee uploaded new patchset

Ethan Lee uploaded patch set #4 to this change.
Following approvals got outdated and were removed:
  • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
  • kokoro-CI-Passes: kokoro-CI-1 by kokoro
Open in Gerrit

Related details

Attention is currently required from:
  • Ethan Lee
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: I72701cb15d83baf4e31ed918c198adf347605a4a
Gerrit-Change-Number: 754420
Gerrit-PatchSet: 4
unsatisfied_requirement
satisfied_requirement
open
diffy

Ethan Lee (Gerrit)

unread,
Mar 13, 2026, 12:40:00 PM (5 days ago) Mar 13
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Ethan Lee

Ethan Lee uploaded new patchset

Ethan Lee uploaded patch set #5 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • Ethan Lee
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: I72701cb15d83baf4e31ed918c198adf347605a4a
Gerrit-Change-Number: 754420
Gerrit-PatchSet: 5
unsatisfied_requirement
satisfied_requirement
open
diffy

kokoro (Gerrit)

unread,
Mar 13, 2026, 12:46:41 PM (5 days ago) Mar 13
to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
Attention needed from Ethan Lee

kokoro voted kokoro-CI-1

Kokoro presubmit build finished with status: FAILURE

Open in Gerrit

Related details

Attention is currently required from:
  • Ethan Lee
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: I72701cb15d83baf4e31ed918c198adf347605a4a
Gerrit-Change-Number: 754420
Gerrit-PatchSet: 4
Gerrit-Owner: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: Ethan Lee <etha...@google.com>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-CC: kokoro <noreply...@google.com>
Gerrit-Attention: Ethan Lee <etha...@google.com>
Gerrit-Comment-Date: Fri, 13 Mar 2026 16:46:36 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Ethan Lee (Gerrit)

unread,
Mar 13, 2026, 2:37:48 PM (5 days ago) Mar 13
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Ethan Lee

Ethan Lee uploaded new patchset

Ethan Lee uploaded patch set #6 to this change.
Following approvals got outdated and were removed:
  • TryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI
Open in Gerrit

Related details

Attention is currently required from:
  • Ethan Lee
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: I72701cb15d83baf4e31ed918c198adf347605a4a
Gerrit-Change-Number: 754420
Gerrit-PatchSet: 6
unsatisfied_requirement
satisfied_requirement
open
diffy

kokoro (Gerrit)

unread,
Mar 13, 2026, 3:05:02 PM (5 days ago) Mar 13
to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
Attention needed from Ethan Lee

kokoro voted kokoro-CI+1

Kokoro presubmit build finished with status: SUCCESS
Logs at: https://source.cloud.google.com/results/invocations/83a6cc23-b11d-4313-b4bf-9a705f4bb8c8

kokoro-CI+1
Open in Gerrit

Related details

Attention is currently required from:
  • Ethan Lee
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: I72701cb15d83baf4e31ed918c198adf347605a4a
    Gerrit-Change-Number: 754420
    Gerrit-PatchSet: 6
    Gerrit-Owner: Ethan Lee <etha...@google.com>
    Gerrit-Reviewer: Ethan Lee <etha...@google.com>
    Gerrit-Reviewer: kokoro <noreply...@google.com>
    Gerrit-CC: kokoro <noreply...@google.com>
    Gerrit-Attention: Ethan Lee <etha...@google.com>
    Gerrit-Comment-Date: Fri, 13 Mar 2026 19:04:57 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Ethan Lee (Gerrit)

    unread,
    Mar 13, 2026, 3:15:35 PM (5 days ago) Mar 13
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Ethan Lee

    Ethan Lee uploaded new patchset

    Ethan Lee uploaded patch set #7 to this change.
    Following approvals got outdated and were removed:
    • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
    • kokoro-CI-Passes: kokoro-CI+1 by kokoro
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ethan Lee
    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: I72701cb15d83baf4e31ed918c198adf347605a4a
      Gerrit-Change-Number: 754420
      Gerrit-PatchSet: 7
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Ethan Lee (Gerrit)

      unread,
      Mar 13, 2026, 3:27:21 PM (5 days ago) Mar 13
      to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
      Attention needed from Ethan Lee

      Ethan Lee uploaded new patchset

      Ethan Lee uploaded patch set #8 to this change.
      Following approvals got outdated and were removed:
      • TryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ethan Lee
      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: I72701cb15d83baf4e31ed918c198adf347605a4a
      Gerrit-Change-Number: 754420
      Gerrit-PatchSet: 8
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      kokoro (Gerrit)

      unread,
      Mar 13, 2026, 3:52:52 PM (5 days ago) Mar 13
      to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, golang-co...@googlegroups.com
      Attention needed from Ethan Lee

      kokoro voted kokoro-CI+1

      Kokoro presubmit build finished with status: SUCCESS

      Related details

      Attention is currently required from:
      • Ethan Lee
      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: I72701cb15d83baf4e31ed918c198adf347605a4a
        Gerrit-Change-Number: 754420
        Gerrit-PatchSet: 8
        Gerrit-Owner: Ethan Lee <etha...@google.com>
        Gerrit-Reviewer: Ethan Lee <etha...@google.com>
        Gerrit-Reviewer: kokoro <noreply...@google.com>
        Gerrit-CC: kokoro <noreply...@google.com>
        Gerrit-Attention: Ethan Lee <etha...@google.com>
        Gerrit-Comment-Date: Fri, 13 Mar 2026 19:52:48 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Jonathan Amsterdam (Gerrit)

        unread,
        9:19 AM (11 hours ago) 9:19 AM
        to Ethan Lee, goph...@pubsubhelper.golang.org, kokoro, Go LUCI, golang-co...@googlegroups.com
        Attention needed from Ethan Lee

        Jonathan Amsterdam added 7 comments

        File internal/api/api.go
        Line 66, Patchset 8 (Latest): } else {
        modulePath = internal.UnknownModulePath
        }
        Jonathan Amsterdam . unresolved

        I think the only case here is zero candidates. Shouldn't that be a bad request (not found) error?

        Line 88, Patchset 8 (Latest): } else if modulePath != "" && modulePath != internal.UnknownModulePath && !isSentinel(requestedVersion) {
        Jonathan Amsterdam . unresolved

        Again, I don't know when this would happen, since you've tried all the candidates.

        Line 141, Patchset 8 (Latest): if fs&internal.WithImports != 0 {
        Jonathan Amsterdam . unresolved

        Why do you need this check?

        Line 146, Patchset 8 (Latest): if fs&internal.WithLicenses != 0 {
        Jonathan Amsterdam . unresolved

        ditto

        Line 156, Patchset 8 (Latest): isLatest := unit.Version == requestedVersion || (requestedVersion == version.Latest && unit.Version != "")
        Jonathan Amsterdam . unresolved

        I don't understand this. Why is it the latest version just because it's the version you asked for?

        Line 175, Patchset 8 (Latest):func isSentinel(v string) bool {
        Jonathan Amsterdam . unresolved

        needsResolution?

        Line 181, Patchset 8 (Latest): w.WriteHeader(status)
        Jonathan Amsterdam . unresolved

        encode to a bytes.Buffer, check error, then write the bytes to w.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ethan Lee
        Submit Requirements:
          • requirement is not satisfiedCode-Review
          • requirement is not 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: I72701cb15d83baf4e31ed918c198adf347605a4a
          Gerrit-Change-Number: 754420
          Gerrit-PatchSet: 8
          Gerrit-Owner: Ethan Lee <etha...@google.com>
          Gerrit-Reviewer: Ethan Lee <etha...@google.com>
          Gerrit-Reviewer: kokoro <noreply...@google.com>
          Gerrit-CC: Jonathan Amsterdam <j...@google.com>
          Gerrit-CC: kokoro <noreply...@google.com>
          Gerrit-Attention: Ethan Lee <etha...@google.com>
          Gerrit-Comment-Date: Wed, 18 Mar 2026 13:19:17 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          unsatisfied_requirement
          satisfied_requirement
          open
          diffy

          Jonathan Amsterdam (Gerrit)

          unread,
          9:26 AM (11 hours ago) 9:26 AM
          to Ethan Lee, goph...@pubsubhelper.golang.org, kokoro, Go LUCI, golang-co...@googlegroups.com
          Attention needed from Ethan Lee

          Jonathan Amsterdam added 1 comment

          File internal/api/api.go
          Line 136, Patchset 8 (Latest): docs = base64.StdEncoding.EncodeToString(d.Source)
          Jonathan Amsterdam . unresolved

          This isn't going to be useful to the user. It consists of encoded ASTs. They need to be rendered.

          Gerrit-Comment-Date: Wed, 18 Mar 2026 13:26:54 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          unsatisfied_requirement
          satisfied_requirement
          open
          diffy

          Jonathan Amsterdam (Gerrit)

          unread,
          11:54 AM (8 hours ago) 11:54 AM
          to Ethan Lee, goph...@pubsubhelper.golang.org, kokoro, Go LUCI, golang-co...@googlegroups.com
          Attention needed from Ethan Lee

          Jonathan Amsterdam added 1 comment

          File internal/api/api.go
          Line 136, Patchset 8: docs = base64.StdEncoding.EncodeToString(d.Source)
          Jonathan Amsterdam . unresolved

          This isn't going to be useful to the user. It consists of encoded ASTs. They need to be rendered.

          Jonathan Amsterdam

          Add a TODO(jba) and I'll take care of it.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Ethan Lee
          Submit Requirements:
            • requirement is not satisfiedCode-Review
            • requirement is not 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: I72701cb15d83baf4e31ed918c198adf347605a4a
            Gerrit-Change-Number: 754420
            Gerrit-PatchSet: 9
            Gerrit-Owner: Ethan Lee <etha...@google.com>
            Gerrit-Reviewer: Ethan Lee <etha...@google.com>
            Gerrit-Reviewer: kokoro <noreply...@google.com>
            Gerrit-CC: Jonathan Amsterdam <j...@google.com>
            Gerrit-CC: kokoro <noreply...@google.com>
            Gerrit-Attention: Ethan Lee <etha...@google.com>
            Gerrit-Comment-Date: Wed, 18 Mar 2026 15:54:48 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Jonathan Amsterdam <j...@google.com>
            unsatisfied_requirement
            open
            diffy

            Ethan Lee (Gerrit)

            unread,
            2:00 PM (6 hours ago) 2:00 PM
            to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
            Attention needed from Ethan Lee

            Ethan Lee uploaded new patchset

            Ethan Lee uploaded patch set #10 to this change.
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Ethan Lee
            Submit Requirements:
            • requirement is not satisfiedCode-Review
            • requirement is not 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: I72701cb15d83baf4e31ed918c198adf347605a4a
            Gerrit-Change-Number: 754420
            Gerrit-PatchSet: 10
            unsatisfied_requirement
            open
            diffy

            Ethan Lee (Gerrit)

            unread,
            2:01 PM (6 hours ago) 2:01 PM
            to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
            Attention needed from Ethan Lee

            Ethan Lee uploaded new patchset

            Ethan Lee uploaded patch set #11 to this change.
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Ethan Lee
            Submit Requirements:
            • requirement is not satisfiedCode-Review
            • requirement is not 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: I72701cb15d83baf4e31ed918c198adf347605a4a
            Gerrit-Change-Number: 754420
            Gerrit-PatchSet: 11
            unsatisfied_requirement
            open
            diffy

            Ethan Lee (Gerrit)

            unread,
            2:01 PM (6 hours ago) 2:01 PM
            to goph...@pubsubhelper.golang.org, Go LUCI, Jonathan Amsterdam, kokoro, golang-co...@googlegroups.com
            Attention needed from Jonathan Amsterdam

            Ethan Lee added 8 comments

            File internal/api/api.go
            Line 66, Patchset 8: } else {
            modulePath = internal.UnknownModulePath
            }
            Jonathan Amsterdam . resolved

            I think the only case here is zero candidates. Shouldn't that be a bad request (not found) error?

            Ethan Lee

            Done

            Line 88, Patchset 8: } else if modulePath != "" && modulePath != internal.UnknownModulePath && !isSentinel(requestedVersion) {
            Jonathan Amsterdam . resolved

            Again, I don't know when this would happen, since you've tried all the candidates.

            Ethan Lee

            Done

            Line 136, Patchset 8: docs = base64.StdEncoding.EncodeToString(d.Source)
            Jonathan Amsterdam . resolved

            This isn't going to be useful to the user. It consists of encoded ASTs. They need to be rendered.

            Jonathan Amsterdam

            Add a TODO(jba) and I'll take care of it.

            Ethan Lee

            Done

            Line 141, Patchset 8: if fs&internal.WithImports != 0 {
            Jonathan Amsterdam . resolved

            Why do you need this check?

            Ethan Lee

            Done

            Line 146, Patchset 8: if fs&internal.WithLicenses != 0 {
            Jonathan Amsterdam . resolved

            ditto

            Ethan Lee

            Done

            Line 156, Patchset 8: isLatest := unit.Version == requestedVersion || (requestedVersion == version.Latest && unit.Version != "")
            Jonathan Amsterdam . resolved

            I don't understand this. Why is it the latest version just because it's the version you asked for?

            Ethan Lee

            Yeah that's wrong. I updated it to check that the version is the same as the module latest good version.

            Line 175, Patchset 8:func isSentinel(v string) bool {
            Jonathan Amsterdam . resolved

            needsResolution?

            Ethan Lee

            Done

            Line 181, Patchset 8: w.WriteHeader(status)
            Jonathan Amsterdam . resolved

            encode to a bytes.Buffer, check error, then write the bytes to w.

            Ethan Lee

            Done

            Open in Gerrit

            Related details

            Attention is currently required from:
            • 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: comment
              Gerrit-Project: pkgsite
              Gerrit-Branch: master
              Gerrit-Change-Id: I72701cb15d83baf4e31ed918c198adf347605a4a
              Gerrit-Change-Number: 754420
              Gerrit-PatchSet: 11
              Gerrit-Owner: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: kokoro <noreply...@google.com>
              Gerrit-CC: Jonathan Amsterdam <j...@google.com>
              Gerrit-CC: kokoro <noreply...@google.com>
              Gerrit-Attention: Jonathan Amsterdam <j...@google.com>
              Gerrit-Comment-Date: Wed, 18 Mar 2026 18:01:23 +0000
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy

              kokoro (Gerrit)

              unread,
              2:09 PM (6 hours ago) 2:09 PM
              to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, Jonathan Amsterdam, golang-co...@googlegroups.com
              Attention needed from Ethan Lee and Jonathan Amsterdam

              kokoro voted kokoro-CI-1

              Kokoro presubmit build finished with status: FAILURE
              Logs at: https://source.cloud.google.com/results/invocations/b4698c1f-cfc4-439f-a221-f4f839d1f621

              kokoro-CI-1
              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: comment
              Gerrit-Project: pkgsite
              Gerrit-Branch: master
              Gerrit-Change-Id: I72701cb15d83baf4e31ed918c198adf347605a4a
              Gerrit-Change-Number: 754420
              Gerrit-PatchSet: 10
              Gerrit-Owner: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: kokoro <noreply...@google.com>
              Gerrit-CC: Jonathan Amsterdam <j...@google.com>
              Gerrit-CC: kokoro <noreply...@google.com>
              Gerrit-Attention: Jonathan Amsterdam <j...@google.com>
              Gerrit-Attention: Ethan Lee <etha...@google.com>
              Gerrit-Comment-Date: Wed, 18 Mar 2026 18:08:57 +0000
              Gerrit-HasComments: No
              Gerrit-Has-Labels: Yes
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy

              Ethan Lee (Gerrit)

              unread,
              2:12 PM (6 hours ago) 2:12 PM
              to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
              Attention needed from Ethan Lee and Jonathan Amsterdam

              Ethan Lee uploaded new patchset

              Ethan Lee uploaded patch set #12 to this change.
              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: I72701cb15d83baf4e31ed918c198adf347605a4a
              Gerrit-Change-Number: 754420
              Gerrit-PatchSet: 12
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy

              kokoro (Gerrit)

              unread,
              2:13 PM (6 hours ago) 2:13 PM
              to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, Jonathan Amsterdam, golang-co...@googlegroups.com
              Attention needed from Ethan Lee and Jonathan Amsterdam

              kokoro voted kokoro-CI-1

              Kokoro presubmit build finished with status: FAILURE

              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: comment
              Gerrit-Project: pkgsite
              Gerrit-Branch: master
              Gerrit-Change-Id: I72701cb15d83baf4e31ed918c198adf347605a4a
              Gerrit-Change-Number: 754420
              Gerrit-PatchSet: 11
              Gerrit-Owner: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: kokoro <noreply...@google.com>
              Gerrit-CC: Jonathan Amsterdam <j...@google.com>
              Gerrit-CC: kokoro <noreply...@google.com>
              Gerrit-Attention: Jonathan Amsterdam <j...@google.com>
              Gerrit-Attention: Ethan Lee <etha...@google.com>
              Gerrit-Comment-Date: Wed, 18 Mar 2026 18:13:51 +0000
              Gerrit-HasComments: No
              Gerrit-Has-Labels: Yes
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy

              kokoro (Gerrit)

              unread,
              2:45 PM (5 hours ago) 2:45 PM
              to Ethan Lee, goph...@pubsubhelper.golang.org, Go LUCI, Jonathan Amsterdam, golang-co...@googlegroups.com
              Attention needed from Ethan Lee and Jonathan Amsterdam

              kokoro voted kokoro-CI-1

              Kokoro presubmit build finished with status: FAILURE

              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: comment
              Gerrit-Project: pkgsite
              Gerrit-Branch: master
              Gerrit-Change-Id: I72701cb15d83baf4e31ed918c198adf347605a4a
              Gerrit-Change-Number: 754420
              Gerrit-PatchSet: 13
              Gerrit-Owner: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: kokoro <noreply...@google.com>
              Gerrit-CC: Jonathan Amsterdam <j...@google.com>
              Gerrit-CC: kokoro <noreply...@google.com>
              Gerrit-Attention: Jonathan Amsterdam <j...@google.com>
              Gerrit-Attention: Ethan Lee <etha...@google.com>
              Gerrit-Comment-Date: Wed, 18 Mar 2026 18:45:39 +0000
              Gerrit-HasComments: No
              Gerrit-Has-Labels: Yes
              unsatisfied_requirement
              satisfied_requirement
              open
              diffy

              Jonathan Amsterdam (Gerrit)

              unread,
              3:09 PM (5 hours ago) 3:09 PM
              to Ethan Lee, goph...@pubsubhelper.golang.org, kokoro, Go LUCI, golang-co...@googlegroups.com
              Attention needed from Ethan Lee

              Jonathan Amsterdam voted Code-Review+2

              Code-Review+2
              Open in Gerrit

              Related details

              Attention is currently required from:
              • Ethan Lee
              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: I72701cb15d83baf4e31ed918c198adf347605a4a
              Gerrit-Change-Number: 754420
              Gerrit-PatchSet: 13
              Gerrit-Owner: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: Ethan Lee <etha...@google.com>
              Gerrit-Reviewer: Jonathan Amsterdam <j...@google.com>
              Gerrit-Reviewer: kokoro <noreply...@google.com>
              Gerrit-CC: kokoro <noreply...@google.com>
              Gerrit-Attention: Ethan Lee <etha...@google.com>
              Gerrit-Comment-Date: Wed, 18 Mar 2026 19:09:25 +0000
              Gerrit-HasComments: No
              Gerrit-Has-Labels: Yes
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy
              Reply all
              Reply to author
              Forward
              0 new messages