| Age | Commit message (Collapse) | Author |
|
Test the ServePackage function against a real database, as well as the
fake data source.
- Modules and packages must be redistributable, or the DB strips
the documentation.
- Documentation must contain source code.
We must temporarily skip the dependency tests, to reduce the diffs on
this change. The test is still important, because it asserts that the
pkgsite command has only a few dependencies. To re-establish it, we
will move the API tests to internal/testing/api.
Change-Id: I67243ea2345c5e735edbdd6ee5bf2349a6b1eb60
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/765502
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
|
|
Instead of falling back to UnknownModulePath, we now:
1. Query all candidate module paths.
2. Filter out candidates where the database fell back to a different module path (preventing false positives like google.golang.org).
3. Filter out deprecated or retracted candidates if at least one good candidate exists.
4. Return 400 if ambiguity remains among good candidates.
This commit fixes the issue where /v1/package/google.golang.org/adk/agent was returning HTTP 400 because all candidate module paths matched:
```
{
"code":400,
"message":"ambiguous package path",
"candidates":[
{"modulePath":"google.golang.org/adk/agent","packagePath":"google.golang.org/adk/agent"},
{"modulePath":"google.golang.org/adk","packagePath":"google.golang.org/adk/agent"},
{"modulePath":"google.golang.org","packagePath":"google.golang.org/adk/agent"}]
}
```
Change-Id: I3ea24bca5144d536490019efd85fb597da214029
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/766380
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
- Refactored error handling to avoid leaking internal implementation
details. Database and system errors are masked by falling back to
standard HTTP statuses but still logging the entire error context.
- User facing error messages can now be specified within the Error
struct.
- Added helpers in types.go to simplify error construction.
- Updated ServeModuleVersions to explicitly return 404 when no versions
are found.
- Expanded test coverage in api_test.go to include 404 and 400 edge
cases.
Change-Id: I89c4be3941126c15df6aefdd21e4bbd2d3b23be1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/764820
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
|
|
Test the "licenses" and "imports" query params for the packages route.
Change-Id: I46c7dd18f0eb2e104d124d2d724039f920247e5b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/764540
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Bypass: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
Auto-Submit: Jonathan Amsterdam <jba@google.com>
|
|
Change-Id: I5510faeb196af4ce1418affe6159b17187b9efa5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/764700
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
|
|
Set an HTTP Cache-Control header for all API responses.
Since requests that reference a specific, numbered version apparently
always produce the same response, it is tempting to use the "immutable"
Cache-Control directive so these pages can be cached indefinitely. But
occasionally we must exclude a module. It would be unfortunate if the
module's data lived in caches forever. Instead, we cache such pages for
one day.
Pages that are subject to more rapid change, like those with versions
"latest", "master" and so on, or those that depend on data other than
a module (imported-by, search, etc.) are cached for an hour.
That is an arbitrary value that seems like a good compromise, since
the likelihood of a particular page's value changing in an hour is low.
Change-Id: I21414c22c724220c993c1dd7e7a0b49074efd8b9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763782
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Bypass: Jonathan Amsterdam <jba@google.com>
|
|
- Enable conditional population of examples by introducing a new
examples parameter.
Change-Id: I53314344a414c41b423185c115e600ec8b63e6bf
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763282
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
|
|
- The relevant logic has already been implemented.
Change-Id: I1d4f92e6d6c00666ba09a532e378fc1f0ede7856
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763400
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
|
|
- Utilize conditional fieldset in GetUnit to efficiently retrieve readme
and license fields.
- Modify Module type to include HasGoMod.
Change-Id: Id22ac3f2485392749742332701d2e913f047b3da
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763401
kokoro-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
|
|
Change-Id: Ie8faec1c02d74ac2559e78d8793d6050a98b38fc
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763281
Auto-Submit: Ethan Lee <ethanalee@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
|
|
Change-Id: Iae93d49fdb6d3a196281d49cd2cf01a8b4e537e2
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763280
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
|
|
Change-Id: I5d8a579913942bcdea664af675ff2ef29888281c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/761400
TryBot-Bypass: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
|
|
renderDoc now includes examples.
It has an option to omit examples, if we decide to omit them
in order to reduce the context load.
Change-Id: Ieaa411fe09b439f51aac7d49195cd5791a20d0d8
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/761000
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
TryBot-Bypass: Jonathan Amsterdam <jba@google.com>
|
|
Change-Id: Ica73fe1f12b2c65d08240479d1a135a51c3ae566
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/758822
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
|
|
- Ensure that all errors are wrapped correctly and served as a json
error response.
Change-Id: I588552c755fb2135916da95dec6d37238d030d39
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/758821
Auto-Submit: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
- All handlers returning lists will utilize the paginate helper.
- Path trimming logic has also been modularized within a helper.
Change-Id: I5c99ae8264ea76587137e29524ad19795652e43b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/758642
Auto-Submit: Ethan Lee <ethanalee@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
|
|
- Create vulnerabilities endpoint using server vuln client.
Change-Id: I234c96851f7682a13bda97aa3e5018d0439e05da
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754866
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
|
|
- Implement ServePackageImportedBy handler and GetImportedBy and GetImportedByCount datasource methods.
Change-Id: I8c4cc65fbff7172eaf48e5426e4f3f41c82bd38e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754865
Reviewed-by: Jonathan Amsterdam <jba@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
|
|
Change-Id: Ib25c913ce7641dea58e2eefb6d65f5cc7dec813a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/760820
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Also add a test case.
Change-Id: Iae30ecca8ebaaa412e9072de5123026ca4f78476
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/760480
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
|
|
Change-Id: I8adf1e62d19cf592cc8204264d99953e12da5843
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/760260
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
|
|
Add a useful helper.
Use it once. We must use it at least once to pass
our check for unused functions.
Change-Id: Ied063f74dc7e3bc7dc7c12d4a17b0e55680951ad
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/759840
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
|
|
- Introduce a new ServePackageSymbols handler that utilizes the new
db.GetSymbols method.
- Consolidated module resolution logic shared by ServePackages into
resolveModulePath.
- Updated Datasource with GetSymbols, which provides a more efficient
way to retrieve all symbols for a package at a given version and build
context. This differs from the existing getPackageSymbols, since that
will return symbols for the latest release/compatible version.
- Refactored packageSymbolQueryJoin into a generic helper by removing
hardcoded version filters. This allows GetSymbols to query for any
specific version, while getPackageSymbols was updated to explicitly
include release-only filters to preserve its existing behavior.
- GetSymbols still utilizes the same underlying packageSymbolQueryJoin,
but it will also attempt to match the most relevant BuildContext for
the query. It will also provide a mapping of parent and child symbols.
Change-Id: Ib18d2511d24ac6bc5b75c7b3809c4ce126245036
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754864
Auto-Submit: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
- Add LatestVersion field to internal.ModuleInfo and update tests
accordingly.
- Changed some test formatting to improve readability.
Change-Id: I1238e54614ef276d219b31d125cd2cad6b5a66f7
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/756901
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
|
|
- Implement ServeSearch method and pagination for search results.
Change-Id: I109d0861b5fa0cfbc20ce20308561ef6b5616405
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754860
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
|
|
- Implement the ServeModulePackages handler and introduce
GetModulePackages to return the list of packages for a given module
version.
Change-Id: I20c1618e2fdbf0126cb913665a1d7457b8951177
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754863
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
|
|
Preliminary attempt to render documentation as text.
The output doesn't match either pkgsite or go doc.
It's a simplification of the latter.
The go doc command turns out to be surprisingly complicated,
so it's best to start simple.
Change-Id: I7b5a6bf36b1892afb30c212309dd646e3cf8b06a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/757501
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Obtain the go/doc.Package from the retrieved unit and validate
the doc query param. Rendering is more complicated; it is deferred
to another CL.
Change-Id: I1d16fe98dbf06457182f5925ce0986448882d40e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/757360
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
|
|
- Implement module versions endpoint using ds.GetVersionsForPath
- Introduce paginate helper to generalize paginaton logic
- Update fakedatasource to correctly use V1Path to return all versions
Change-Id: Icc028bf8ca9c13978bb6eba84afe9736ccd6bcee
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754862
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
|
|
- Large documentations blobs should avoid being returned unless
explicitly requested. Add a WithDocsSource to enable retrieval of
unit information without the large documentation source information.
- This does not functionally change existing GetUnit callsites.
Change-Id: Ie983b7eaeb61bb92f2716ae64a3d1e1ea738dbe2
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/756480
Reviewed-by: Jonathan Amsterdam <jba@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Change-Id: Id6b8686012803c88c9b7ea71e4b1c0058b7967b0
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754861
Auto-Submit: Ethan Lee <ethanalee@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
|
|
- Create handler for serving v1 package endpoint.
- Create tests to verify endpoint behavior.
Change-Id: I72701cb15d83baf4e31ed918c198adf347605a4a
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754420
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
|
|
- Minor doc changes.
- Slight code reorg.
- Use new reflect.Pointer over reflect.Ptr.
Change-Id: If1a6bb1d335f32a119cc8b4487e3eacbcd6b6431
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/756420
Reviewed-by: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
- Introduce structs that will be used to parse query parameters.
- Implement parsing method and create relevant tests.
Change-Id: Ib54a57a7eb8d2dbaab0edf705a6cb9e5bc8288a9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754240
Auto-Submit: Ethan Lee <ethanalee@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
|
|
- This new error type should also capture alternative candidates given
an ambiguous package path.
Change-Id: I748cecdcc9d7656d4ea4d148dff090e230676f08
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/754500
Auto-Submit: Ethan Lee <ethanalee@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
|
|
- Defined comprehensive types to represent return structures for
upcoming REST API.
Change-Id: Ie46aef2a4677daec9e5bb18c2ecd08cee8cb3c32
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/749120
kokoro-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ethan Lee <ethanalee@google.com>
|