aboutsummaryrefslogtreecommitdiff
path: root/internal/testing/sample/sample.go
AgeCommit message (Collapse)Author
6 daysinternal/api: add examples parameter to PackageParamsEthan Lee
- 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>
2026-03-25all: add LatestVersion to ModuleInfoEthan Lee
- 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>
2025-11-13internal/testing: avoid data race to NonRedistributableLicenseRob Findley
During insertion, pkgsite may mutate non-redistributable licenses to purge their contents. This leads to data races and path dependence in tests that were reusing the sample.NonRedistributableLicense value. Turn this variable into a function, so that we return a new value each time. This revealed a logic error in TestGetLicensesBypass: the test which was nominally checking that the non-redistributable contents were returned, was in fact also emptying out the expected contents, probably to make the test pass given the bug fixed above. Change-Id: I957014d009ae41638599d61592766b7ae1c175e7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/720260 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>
2024-01-23internal: move UnitMeta.IsRedistributable to UnitMichael Matloob
Change-Id: Ia0a18df32d752f20b0400b47860638c7d0910eb7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/556435 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> Reviewed-by: Robert Findley <rfindley@google.com>
2024-01-22internal: move UnitMeta.Licenses to UnitMichael Matloob
Change-Id: If2b3c1acd4830948e2d134517608f89771a7abcb Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/555735 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> Reviewed-by: Robert Findley <rfindley@google.com>
2022-04-11all: gofmtRuss Cox
Gofmt to update doc comments to the new formatting. For golang/go#51082. Change-Id: Ia9e71e7ecac75822ff43d6c7e60f512442a5fa50 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/399617 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-11-15internal/licenses: remove Metadata.OldCoverageJonathan Amsterdam
We don't need the OldCoverage field anymore. All DBs have only the new Coverage information. Change-Id: Ib2d8e0cdacdc2f7b6514a8a5310d6905be15136c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/363954 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-08-24internal/fetch: populate Unit.BuildContextsJonathan Amsterdam
Populate the lists of build contexts when fetching a module. Currently we only do this when reading from the DB. We want DataSources that rely only on fetch to have the right value. For golang/go#47780 Change-Id: Ie85fba8ccb318bb4ed5c1f2153b0ba4216358022 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/344670 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-07-13internal/postgres: change upsertSymbolSearchDocuments queryJulie Qiu
The upsertSymbolSearchDocuments query is changed to filter on module path and version, instead of passing an array of unit_ids. Additional tests are added to TestSymbolSearch. For golang/go#44142 Change-Id: Ic0c493711c2c8fcc32e207ea466c509e6f99209b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/329924 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-05-17internal/postgres: add symbol searchJulie Qiu
An initial version of symbol search is added. This runs separately from regular search and is not connected to the frontend yet. For golang/go#44142 Change-Id: I34a21a4a743a07dcfcdfeb64b52a86bc2254f62a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/318870 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-05-04internal: change Symbol.Children to SymbolMetaJulie Qiu
The children of a symbol will always have the same build context and no other children. As a result, Symbol.Children are changed to the SymbolMeta type. For golang/go#37102 Change-Id: I89c361f86eff7179c18572e57a5dd0788fea4b1d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/315432 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-05-04internal: factor out SymbolMetaJulie Qiu
UnitSymbol and Symbol share a lot of fields, which are now factored out as SymbolMeta. For golang/go#37102 Change-Id: Ie8590b0a50dafa4199fbe165d94f28028d1a0bb5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/315431 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-03-01internal: do not display README at /stdJulie Qiu
The README is no longer displayed at pkg.go.dev/std. It is also no longer stored in the database when a std module is fetched. For golang/go#44356 Change-Id: I6b1605389bc3c97694b6ec2b06e28006a38be999 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/296950 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-02-25internal/postgres: insert documentation_symbolsJulie Qiu
Data is now written to the documentation_symbols table. An experiment flag "insert-symbols" is added for writing data to symbol_names, package_symbols and documentation_symbols. For golang/go#37102 Change-Id: Id95c754740a7dd5f836bf0766815b274dba6790b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/296189 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-25internal: embed ModuleInfo into UnitMetaJonathan Amsterdam
UnitMeta had most of the fields of ModuleInfo, but did not embed it. Now that we have added four more fields to ModuleInfo for deprecation and retraction, it makes sense to embed it rather than duplicate those fields. For golang/go#43265 For golang/go#41321 Change-Id: I20e2b922b49c7873a5535745d644631123de37cd Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/296209 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-19internal/postgres: update insertSymbolsJulie Qiu
insertSymbols is updated to match the new schema for symbols. For golang/go#37102 Change-Id: Icd29fffe5d2d9a2ddf0201af7add9fb45fb9a30e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293954 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-19internal/testing/sample: make a fresh copy of ImportsJonathan Amsterdam
Create a new slice of imports each time it's used. This ensures that memory isn't shared between sample modules. It addresses a race condition we saw when running postgres tests concurrently. Change-Id: I0c1e0112ff7b944433565c7cacdd7226a32ad4eb Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/294149 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-02-18internal/postgres: insert symbol historyJulie Qiu
Data for a package's symbol history is inserted into the symbol_history table. This change is added behind a feature flag as additional tests will be added. This change does not take into account cases where the GOOS/GOARCH for a package changes from "all/all" to all of the supported build context combinations at a later version. This edge case will be addressed in a later CL. For golang/go#37102 Change-Id: Ia3abf1cf63159cb5b1b2b926a305ab606926a4ec Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/292511 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-17internal/sample: improve treatment of sample licensesJonathan Amsterdam
To avoid sharing between tests, which can lead to race conditions, create new sample license slices and structs each time we need them. This uncovered some problems in the postgres tests. - The UpsertModule test was changing the top-level module license, but didn't propagate that change through all the units. We sample.ReplaceLicense to address that. - The checkModule was filling in missing license with defaults, instead of the correct data. Change-Id: I6074914155eb33d6ed6882f81a9d57b20135e422 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/292929 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-02-12internal/postgres: insert symbol namesJulie Qiu
Insert symbol names into the symbols table when package documentation is inserted. For golang/go#37102 Change-Id: I82cc0425ec9cdadc2c5449038fedfd6920e1adc0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/291089 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-02-09internal/sample: generate sample doc dynamicallyJonathan Amsterdam
Generate all internal.Documentation values for testing during the test run, removing the need for running `go generate`. - Move godoc.DocumentationForTesting to sample.Documentation, now that the import cycle is broken. - Add sample.Doc for tests that don't care about the Documentation contents. - Delete gen_documentation.go, the program that previously generated the documentation, as well as its output, documentation.gen.go. Change-Id: I81116aa133837a80047031c890b00f30cdd2e825 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/290372 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-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-05internal/testing/sample: use UTC for timeJonathan Amsterdam
Use UTC for sample.CommitTime, instead of the local timezone. This avoids time-dependent test failure due to a mismatch between the database's timezone (UTC) and the test runner's local time. As an example, say a developer runs `go test` on a machine in the US Eastern timezone (UTC-5). Consider TestFetchPackageVersionsDetails in internal/frontend/versions_test.go. This test compares commit times from the DB and from the local machine, formatted as date strings. From 7pm (5 hours before the date changes) until midnight, this test will fail because the Eastern day is one less than the UTC day. For instance, at 8pm EST on a Wednesday, it is 1am UTC on a Thursday. After this CL, all times are UTC, so the days will be same. Change-Id: Ia7bfc964c650aebbc6d20be1feda3e61fc8f2449 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/289949 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-02many: allow for multiple documentations for a UnitJonathan Amsterdam
Change internal.Unit.Documentation from a single internal.Documentation to a slice, so that a Unit can have doc for multiple build contexts. However, don't use this ability yet: fetch takes only the first build context it finds, postgres inserts only the first, frontend renders only the first, etc. For golang/go#37232 Change-Id: I17fd1ff2378e0862c029c8077057c207001f6136 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/288217 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> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2021-01-13internal/licenses: rename Coverage fieldsJonathan Amsterdam
Coverage -> OldCoverage NewCoverage -> Coverage Change-Id: I05b41e1525700b3539dad9894b6b678f6c88c67d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/283653 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-01-06internal/licenses: upgrade to latest licensecheckJonathan Amsterdam
The new licensecheck is a rewrite of the old with a different API and implementation. We will eventually switch to it, but first we upgrade to a version with both the old and new APIs, and continue using the old one. I confirmed (by running an internal tool) that the change to github.com/google/licensecheck/old@v0.3.1 doesn't affect any licenses in our database. Change-Id: I825b139b45c05b711c39b6018d7ba5f89a1886ad Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/281952 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>
2020-12-14internal/frontend: fix commitTime for testsJulie Qiu
CL 268638 added `.In(time.UTC)` to the commitTime for several tests. This was causing tests to fail when run locally, due to different outputs of absoluteTime. absoluteTime for these commit times are now computed within the tests. sample.UnitMeta also now sets the CommitTime to NowTruncated(). Change-Id: I3187c9a5eacd5d136c73080b2803241cb2022729 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/271808 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>
2020-11-24internal/postgres: stop inserting documentation.htmlJonathan Amsterdam
HTML is now always generated from the source on the frontend, so we don't need to store it in the DB anymore. Change-Id: Iedbac3df0c298af1f0e9f01f3c08ccd267b76053 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272508 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>
2020-10-27internal/frontend: use definitions from internal/testing/sampleJonathan Amsterdam
Change-Id: Ic435c89ae39d03bec0bb3303c80761fa873f5747 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265558 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
2020-10-27internal/testing/sample,etc.: add package sourceJonathan Amsterdam
Add encoded source to the sample Documentation value, and render it to get the documentation HTML. Use the package in internal/godoc/testdata. I had hoped to use the godoc package in an init function to create the needed values, but that caused an import cycle between sample and the godoc test package. So instead, a small program invoked with `go generate` uses godoc to generate the values and embed them in a Go file. This change required a few other changes: internal/postgres: Always insert source when comparing Documentation. internal/frontend: Change the strings we look for in doc to match the one in the sample package. internal/frontend: Remove the check on HTML ids. This was added when I was doing safehtml, when I was being strict about HTML ids. The safehtml package wants ids to conform to some strict rules to avoid certain attacks, and I tried to follow those rules. But in the end I had to be more forgiving, or I would have broken anchor tags to Go symbols, like pkg.go.dev/fmt#Println. (safehtml does not consider "Println" a safe identifier unless it is a constant string.) The checkIDs function was added somewhere in the middle of that process, and it worked until now because the value of sample.DocumentationHTML was an ordinary text string with no ids, not real HTML doc. It was actually only checking the ids for license files, and those do contain a hyphen. I don't think its loss is important. Change-Id: I4019c56b216aaf1a4e92a6167c2af1eef4cfbf89 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265297 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-10-26internal/{frontend,postgres,testing}: set unit.NumImportsJonathan Amsterdam
Set the NumImports field whenever we set Imports. Fixes b/171487247 Change-Id: I144fc2c36503c204712c694e0ff8a6ea4ece4bfb Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/264860 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-10-26internal/testing/sample: move all structs to sample.goJulie Qiu
There are no more legacy functions remaining. All functions are moved to sample.go and legacy.go is deleted. For golang/go#39629 Change-Id: I54789bfd8db5713105a574e08143e272b08bafb6 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265007 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>
2020-10-26internal/testing/sample: remove LegacyAddPackageJulie Qiu
LegacyAddPackage is removed. AddPackage is used instead where applicable. For golang/go#39629 Change-Id: I61741f8c5c55fb173521b2fdd06259064d77270b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265003 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-10-26internal/testing/sample: deprecate legacyUnitForPackageJulie Qiu
legacyUnitForPackage is deprecated in favor of UnitForPackage. legacyUnitForModuleRoot is also renamed to UnitForModuleRoot. For golang/go#39629 Change-Id: I73f781e570552656262f9982bb2a018937598306 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265002 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>
2020-10-19internal/testing/sample: add UnitForPackageJulie Qiu
For golang/go#39629 Change-Id: Idcc525d1127a0e5bb67a758d8e049402997fc261 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/263214 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-10-02internal/testing/sample: add AddPackageJulie Qiu
For golang/go#39629 Change-Id: I9dcf43ec3ec245ef1514b6bdb64afd1e8266a425 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258561 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>
2020-10-01internal/testing/sample: combine ModuleInfo and ModuleInfoReleaseTypeJulie Qiu
ModuleInfo and ModuleInfoReleaseType are effectively the same function and are combined. internal/frontend/directory_test.go also no longer creates ModuleInfos with version=latest. Change-Id: Ib14f39fd2ddf6afec57c43b0b09bda42c1a8b508 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258598 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-10-01internal/testing/sample: move legacy functions to legacy.goJulie Qiu
Any function that references a legacy struct is moved to legacy.go. Pure code in motion. These functions will either be deprecated or rewritten to not use a legacy struct in a future CL. For golang/go#39629 Change-Id: I8574fe3f90c1f17eec6b5f181feb42ee137bca5d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258597 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>
2020-10-01internal/postgres: update GetPackagesForSearchDocumentUpsert to use readmes ↵Julie Qiu
table GetPackagesForSearchDocumentUpsert is updated to fetch readme data from the readmes table instead of modules.readme_file_path and modules.readme_contents. For golang/go#258311 Change-Id: I8fbba5cd48643f583bcf56259096011322e46eee Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258311 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-29internal/frontend: fix TestFetchDirectoryDetailsJulie Qiu
TestFetchDirectoryDetails wasn't checking the output of fetchDirectoryDetails. Tests for this function are fixed. TestFetchDirectoryDetailsInvalidArguments is also updated to test fetchDirectoryDetails. For golang/go#39629 Change-Id: Ib21f58790cfa8ddca31cf539869c4989df950c0f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258222 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>
2020-09-09internal: delete DirectoryMetaJulie Qiu
For golang/go#39629 Change-Id: I7356133c4b628c00803405dd1ce9e8677b7ae077 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/252918 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-02internal: add WithSubdirectories support to GetUnitJulie Qiu
GetUnit now returns the subdirectories for that unit, when the WithSubdirectories fieldset is provided. For golang/go#39629 Change-Id: I3976cfec67bc70fc2d532583f2ab2d2af14eada1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/252401 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-02internal: remove Unit.PackageJulie Qiu
Unit.Pacakge is removed, since it isn't need for anything. For golang/go#39629 Change-Id: Ic620603550874de8a0b4c37c67a88bee65ec7933 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/252323 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-02internal: move Unit.Package.Documentation to Unit.DocumentationJulie Qiu
The Documentation field is moved from Unit.Package.Documentation to Unit.Documentation. Unit.Package will be deprecated in a later CL. For golang/go#39629 Change-Id: Idc6d6598a2647a55b55c947120c322fec5da59cc Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/252321 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-02internal/postgres: add WithLicenses to GetUnitJulie Qiu
GetUnit now supports the WithLicenses fieldset, which fetches license contents for the unit. For golang/go#39629 Change-Id: Ic51baf1d36e75c7ad05c59d232f400a756fb7a94 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/252318 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-01internal: rename PathInfo to UnitMetaJulie Qiu
PathInfo is renamed to UnitMeta, and GetPathInfo is renamed to GetUnitMeta. For golang/go#39629 Change-Id: Ia91cf7d2752988653efcc0e46a4d6b8b63017ef3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251978 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-01internal: replace Unit.DirectoryMeta with Unit.PathInfoJulie Qiu
Unit.DirectoryMeta is replaced with Unit.PathInfo DirectoryMeta isn't necessary and will be deleted in a future CL. For golang/go#39629 Change-Id: I521a062207d3f48592d6e949306a015458d1398d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251957 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-01internal/postgres: add data to PathInfoJulie Qiu
The following fields are added to GetPathInfo: - CommitTime - License metadata - RepositoryURL - PackageSourceURL For golang/go#39629 Change-Id: I664a0e96647ae2ad2404631e27f714b64db5c79c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251919 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>