aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/insert_module_test.go
AgeCommit message (Collapse)Author
2020-11-24internal: add WithMain field setJulie Qiu
The WithDocumentation, WithReadme and WithSubdirectories field set are replaced by WithMain, since the main page always requires all of that information. WithMain also returns NumImports and NumImportedBy. Change-Id: I15d8aa7a1332da78d5dee49b418d7773c87b115b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/271418 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-11-24internal/postgres: delete use of ExperimentUnitPageJulie Qiu
ExperimentUnitPage is no longer used by internal/postgres. Change-Id: I19a9f7953a87e559a4acdb5f4a3712f9b2a79f01 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/272609 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-11-20internal: rename tc to testJulie Qiu
The variable tc is renamed to test when used to refer to a test case, for consistency throughout the rest of the codebase, which uses the variable test in most cases. Change-Id: I88a87aa020928af98e8579a299f3111718dfa044 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/271809 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Trust: Julie Qiu <julie@golang.org>
2020-10-28internal: remove insert-package-source experimentJonathan Amsterdam
It is at 100% in all environments. Change-Id: I4e2b859e9cd81df1ddfa9e677afe8d13d31b400f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265878 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/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/postgres: fix LegacyModuleInfo reference in commentJulie Qiu
For golang/go#39629 Change-Id: Ib9ebfd19e18ab8ade23f1aad58993dff3a334ada Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265008 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: rename LegacyDefaultModule to DefaultModuleJulie Qiu
For golang/go#39629 Change-Id: I9f33c8fb0dc2573f4c6332f6e1beb8acf92ac098 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265006 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: rename LegacyModule to ModuleJulie Qiu
For golang/go#39629 Change-Id: I83c2afdf32b58594e9ab00b545ae1bfebbd5491b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265005 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-16internal/postgres: replace LegacyPackage in insert_module_test.goJulie Qiu
For golang/go#39629 Change-Id: I8b2f8eda2035ad121abd01922f1938f9e0db5caa Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/263202 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-10-07internal/postgres: update definition of latestJulie Qiu
The definition of latest is updated to prefer incompatible release/prerelease versions over pseudoversion. This matches the definition by cmd/go. Change-Id: Ic3c79c32e14dc4df3cf11d52df6548f0fd781a6b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/259997 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: don't insert modules.readme_*Julie Qiu
Data is no longer written into modules.readme_file_path and modules.readme_contents. For golang/go#39629 Change-Id: Id879004373493b45c540e5adb11b075d8beadf60 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258318 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: delete LegacyGetPackageJulie Qiu
For golang/go#39629 Change-Id: I4e8cb716f16821bfe884cfe1e4b5f05ef62f16ef Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258317 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: prefix legacy functions with LegacyJulie Qiu
For golang/go#39629 Change-Id: I3953c39e419ac8b74ac7f61ac6ffa9ec39e288aa Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258599 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-09-30internal/postgres: delete LegacyGetModuleInfoJulie Qiu
For golang/go#39629 Change-Id: I3be1a9ce361d73e0d6f7b373ac7c410bc571481b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258290 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
2020-09-14internal/postgres: prefer prerelease over pseudo as latest versionJulie Qiu
The definition of @latest is changed to prefer pre-release versions over pseudo-versions. This matches the definition of @latest for the go command as of go1.13. For golang/go#41379 Change-Id: Ia5e4cc42822245636d216467aee1e088a40569c5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/254577 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Trust: Julie Qiu <julie@golang.org>
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-08-28internal: change signature of GetUnitJulie Qiu
For golang/go#39629 Change-Id: I210b767582bdc7e5bb3adae72a3e4d9a83be5ab5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251268 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-08-28internal: rename Module.Directories to Module.UnitsJulie Qiu
For golang/go#39629 Change-Id: I52d071d035c66dd385e4d32c08b039fddfcb01d7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251173 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-08-28internal: rename GetDirectory to GetUnitJulie Qiu
For golang/go#39629 Change-Id: I5275442a15f066b4c48325880771703a2a77f249 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/251164 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-08-28internal/postgres: use FieldSet in GetDirectoryJulie Qiu
GetDirectory now supports the WithDocumentation, WithReadme, and AllFields fieldsets. At the moment, only one fieldset can be specified at a time. Additional support will be updated in future CLs. For golang/go#39629 Change-Id: I42b15d2d06a0b36aa0298a79ea1c06303b682926 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/250946 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-08-26internal: change signature of GetDirectoryJulie Qiu
The signature of GetDirectory is changed to: GetDirectory(ctx context.Context, fullPath, modulePath, version string, pathID int, fields []internal.FieldSet) (*internal.Directory, error) The allows the caller to pass in a pathID, if known, and specify specific fields that they want to fetch, for optimization. No functional changes to GetDirectory are made in this CL, just an update to the DatsSource interface, and how it is used in internal/frontend. For golang/go#39629 Change-Id: Ic44225a13bf2cf04a62af652dbb830c4d256cb37 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/250799 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-08-26internal: add Name to DirectoryMetaJulie Qiu
For golang/go#39629 Change-Id: Iad754b0c4e82b859b6a3dac60ace85c621423d7b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/250538 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-08-25internal: add PathID to DirectoryMetaJulie Qiu
In later CLs, PathID will be used as input for various postgres functions. For golang/go#39629 Change-Id: Ic40205d4c58803f28de1cbe59809cbbe35df1c2d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/250537 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-08-25internal: merge Directory and VersionedDirectoryJulie Qiu
Directory and VersionedDirectory are merged into a single struct, since VersionedDirectory doesn't provide additional value. In this CL, Directory is removed. VersionedDirectory will be renamed to Directory in the next CL to make it easier to review. For golang/go#39629 Change-Id: I4f29bcd5db673c1c715cdd0bc8bd5391cd65d45d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/250505 Reviewed-by: Jamal Carvalho <jamal@golang.org>
2020-08-25internal: add ModuleInfo to DirectoryMetaJulie Qiu
ModuleInfo is moved from VersionedDirectory.ModuleInfo to DirectoryMeta.ModuleInfo, since we want access to those fields without fetching the entire VersionedDirectory. For golang/go#39629 Change-Id: Id468774f45ea0c5cbe7b46634249bea2d5721919 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/250504 Run-TryBot: Julie Qiu <julie@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
2020-08-19internal/postgres: don't insert a documentation row for non-redistributable ↵Jonathan Amsterdam
packages If a package is not redistributable, do not insert a row in the documentation table for it. Previously, we inserted a row with the synopsis and HTML empty. Change-Id: Ic0cdec85707dbe5d191f55035fcfd8e655bf6c38 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/248958 Reviewed-by: Julie Qiu <julie@golang.org>
2020-08-17internal/postgres: minor changes to TestLatestVersionJonathan Amsterdam
Remove unused field; adjust error message. Change-Id: I0800fa472774394d4c3a022dddc8dd5a18882a13 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/248837 Reviewed-by: Julie Qiu <julie@golang.org>
2020-08-13internal/postgres: populate modules.incompatible fieldMiguel Acero
This change modifies the InsertModule function to insert modules with an Incompatible field for the new Incompatible column in the modules table. A test is added to check the latest version of inserted modules. Updates golang/go#37714 Change-Id: I7ef04b8709f9499d747d9795531cbc83b5de25ad Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/247757 Reviewed-by: Julie Qiu <julie@golang.org>
2020-08-06internal/postgres,etc.: support bypassing license restrictionsJonathan Amsterdam
Add a mode to postgres.DB where data is saved even if the module or package is not redistributable. This "bypassing license restrictions" mode is off by default. Add a flag to the worker binary to turn it on. Used a flag rather than an environment variable so there is no way for ambient state to affect the binary for this important decision. Also: - Add a test to verify that license data is removed/not removed depending on the bypass setting. - Fix a bug where the new model insertion wasn't omitting documentation for non-redistributable modules. - Fix a bug in internal/sample where the top-level readme wasn't getting populated. A later CL will change the frontend to bypass the check. For golang/go#39602 For golang/go#39629 Change-Id: I67a6d24c18f3b93cfbfc9ec2a20159c07a84e077 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246957 Reviewed-by: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
2020-07-31internal/postgres: treat a zero commit time as a bad moduleJonathan Amsterdam
Previously, a zero commit time in a module caused it to be reprocessed. Instead, it should fail permanently. Fixes b/162315868. Change-Id: I68f36b29dce41690abeca26ac0908ddc0a109af9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245918 Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-16internal/derrors: rename ToHTTPStatus to ToStatusJulie Qiu
ToHTTPStatus is renamed to ToStatus, since several derrors codes are not HTTP status codes. Change-Id: I41bf1452fdbbafe1a4f752bc3092e39515a2db4b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242882 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-10internal: remove New suffix from structsJulie Qiu
The New suffix is removed from PackageNew and DirectoryNew, since the legacy methods are already prefixed with "Legacy". For golang/go#39629 Change-Id: I8be32310c6b451035021663000aac6ca845ee6e0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241900 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-07internal: delete insert-directories experimentJulie Qiu
The insert-directories experiment flag is deleted, since we have already inserted data for all modules into the paths, package_imports, documentation, and readmes table, and been running that code path for a while. Updates golang/go#39629 Change-Id: I323850a462672c41ad0c67b6ab2b173bb32bf441 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241320 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-07internal: use safehtml for doc fieldsJonathan Amsterdam
Change the type of the documentation fields from string to safehtml.HTML. This forces the conversions between strings and safehtml.HTML values to happen at the lowest level, reading and writing to the database. That increases our confidence that nothing will modify the HTML after it is read from the DB and before it is used in a template. Change-Id: If5d65123ce2b69ef3183221048aa6d081b003762 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240510 Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-06internal/experiment: improve ergonomics for NewSet and NewContextJulie Qiu
Previously, NewSet and NewContext required the caller to construct a set that was passed in. The functions now accept experiment names, to make them easier to use. Change-Id: Id306902910d51483c48a6a3bc8205cf484694d6a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240857 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-29internal/postgres: remove module from version_map in DeleteModuleBharath Thiruveedula
postgres.DeleteModule is updated to delete the corresponding module_path and resolved_version row from the version_map table. Fixes #39633 Change-Id: I9de46b08e535bea52c2ea4dbab1c71a8e1c2c2f7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238637 Reviewed-by: Julie Qiu <julie@golang.org>
2020-06-17internal: clean up issue linksJulie Qiu
This is the first CL to clean up various TODOs that are outdated, and replace internal issue links with GitHub issue links. Updates golang/go#39621 Change-Id: If270e8b2e8198c007cb4aa71ad8486182f4f3380 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238319 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-16internal: rename GetModuleInfo to LegacyGetModuleInfoJulie Qiu
Change-Id: Ifa83e3bb400902a9c163c0911a361425fceca1c6 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238098 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-16internal: rename GetPackage to LegacyGetPackageJulie Qiu
Change-Id: Ia9123b6551d950a7ecfdf808e3da5c788512d60a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238026 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-11internal: add ModuleInfoJulie Qiu
ModuleInfo is added, which represents the module info for the new data model. ModuleInfo is embedded in LegacyModuleInfo. In order to support the existing overview tab functionality, GetDirectoryNew was changed to return the module README, regardless of whether there is a README for the directory. We will change this logic to display the README for the directory in a future CL. Change-Id: I624a6d99b711870826fd7dff9100d4ad47852db2 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/766801 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-10internal/testing/sample: add AddDirectory functionJonathan Amsterdam
Add a function that checks for duplicate directory paths. Change-Id: I4b8d10c4f4cb6cf88455bae73eb43ca706aee425 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/766368 CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com> Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-06-10internal/postgres: upsert module dataJonathan Amsterdam
When we insert module information, make sure we overwrite existing rows. Previously, we specified that new data should be ignored if the row already existed, which meant that we were adding rows but never changing them. That didn't matter at one point, when we deleted a module before re-inserting it, but we no longer delete, so we must upsert. We also fix a number of places where our test modules had duplicate directories. The upserts failed for these. Change-Id: I97465b11e4ea6cbb7835e883f36f098445207eba Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/766365 Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-06-09internal: rename ModuleInfo to LegacyModuleInfoJulie Qiu
ModuleInfo is renamed to LegacyModuleInfo, as a step towards deprecating LegacyReadmeFilePath and LegacyReadmeContents. In a follow up CL, we will add ModuleInfo as an embedded struct to LegacyModuleInfo. Change-Id: Ie452420448eec1d13edaf62e548df0b9e2cbbe4b Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/766479 CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-06-08internal: prefix legacy structs with LegacyJulie Qiu
The following structs have been renamed with a Legacy prefix: * internal.Directory * internal.Package * internal.VersionedPackage * sample.Package The following fields on internal.ModuleInfo have also been changed: * ReadmeFilePath * ReadmeFileContents This is done to help us distinguish between legacy and method structs/methods while migrating code to the new data model. Change-Id: Ibedf71d4db6323ef5aa05d73a0240537ea6073d3 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/765160 CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>