aboutsummaryrefslogtreecommitdiff
path: root/internal/build_context.go
AgeCommit message (Collapse)Author
2026-03-26internal: consolidate build context and unit resolution logicEthan Lee
- Centralize logic for resolving units and selecting the best matching build context. - New helpers MatchingBuildContext, SortedBuildContexts provide a consistent, efficient approach to build context selection. - DocumentationForBuildContext now finds the best match based on precdence rules rather than just returning the first match. - A new getUnitContext helper resolves unit metadata and the best build context in a single query. - GetSymbols and GetUnit are now both optimized to use pre-resolved IDs, simplifying their queries and removing redundant joins. - Replaced redundant matchingDoc functions in fetchdatasource and fakedatasource. Change-Id: I9207d3bfe03404483c816090a0b99666f14a36e3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/759162 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>
2021-04-29internal/postgres: read only one doc source from DBJonathan Amsterdam
If GetUnit is passed a build context, it will read documentation source only for that build context. It still reads all the build context values, just only one serialized blob of file ASTs. This sped up getUnitWithAllFields by about 2x on net/http, using detail-stats against the staging DB from a local frontend. Change-Id: Ib8e988940b7f8f8ef2c270129c4338bb3d56b9eb Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/312269 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-03-30internal: don't panic on all/allJonathan Amsterdam
If CompareBuildContexts sees all/all, it prefers it instead of panicking. Change-Id: I50ff46fa2bbad47cfe5539297a08744dd62b261c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/305969 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-03-09internal/frontend: add version historyJulie Qiu
Symbol history is added to the versions page, for when a symbol is first introduced to the package API. For golang/go#37102 Change-Id: I22b7bc959a464dc38fe0bd39244c997fd51370f1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/298309 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-02-23internal/postgres: change buildcontext key in getSymbolHistoryJulie Qiu
Instead of using a custom string as the key in getSymbolHistory, just use internal.BuildContext. For golang/go#37102 Change-Id: I87feabd36a6b33fc9a34bd5cf3ab0012bdbbf012 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/294689 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-02-08internal: support "all" in BuildContextJonathan Amsterdam
Handle BuildContexts where one or more parts are "all". These should only occur when searching for a matching Documentation, not sorting. (Because we sort only when there is more than one Documentation, and if there is an all/all Documentation then there aren't any others.) For golang/go#37232 Change-Id: I898aba8f73d2682798d56c47cc6773709f10c702 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/290094 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-02-05Revert "internal: support "all" in BuildContext"Jonathan Amsterdam
This reverts commit 5289fe63bf336e52e579b0e30c4616bcfe3a31ad. Reason for revert: breaks build Change-Id: Iedc647645373a2c3e1ddf6a414564edfc4cae406 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/290069 Reviewed-by: Julie Qiu <julie@golang.org> Trust: Jonathan Amsterdam <jba@google.com>
2021-02-05internal: support "all" in BuildContextJonathan Amsterdam
Handle BuildContexts where one or more parts are "all". These should only occur when searching for a matching Documentation, not sorting. (Because we sort only when there is more than one Documentation, and if there is an all/all Documentation then there aren't any others.) Change-Id: Ibe28bd78fa278c042d1459f7046bfe8eef49bbac Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/289679 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-02-03internal/frontend: support GOOS/GOARCH query paramsJonathan Amsterdam
For golang/go#37232 Change-Id: I657fac293fdc6970ee71805b00b06086a7d4d5c7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/289238 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-01-29internal: put build context information in a single placeJonathan Amsterdam
In forthcoming CLs, we will need to manipulate and compare Go build contexts (GOOS/GOARCH pairs). Define a struct for them and put it and support functions in a common package. Change-Id: I15d00556fa39e32d1db367f4d33276632300dcbe Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/288213 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>