pkgsite/internal/postgres
Jonathan Amsterdam 1551f083f9 internal/postgres: insert module path even if not a package
When inserting the paths of a module into the paths table, we were
inserting all the package paths and the v1 module path (the module path
without "/vN" suffix). That is almost always sufficient. But if a module
has a version suffix and is not itself a package, then we were not
inserting its path. The module path is needed by insertSymbols, so this
was causing that function to fail.

Add the module path, refactor the code to simplify it and allow testing,
and add a test.

(For a vN module the code also adds the v1 package path for every
package. I think this is unnecessary, but it's too risky to remove
it.)

Change-Id: I8caa3dd945692a4ec0a1128199237de6b77aa719
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/609117
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
2024-09-04 17:48:17 +00:00
..
search many: re-enable staticcheck and fix problems 2022-06-17 13:49:06 +00:00
testdata internal/postgres: remove null runes from licenses 2020-03-27 16:46:49 -04:00
benchmarks_test.go internal/config: separate config initialization into serverconfig 2023-08-25 19:08:11 +00:00
clean.go internal/postgres: rename CleanModule to CleanAllModuleVersions 2021-08-17 16:58:03 +00:00
clean_test.go internal/postgres: rename CleanModule to CleanAllModuleVersions 2021-08-17 16:58:03 +00:00
delete.go worker: display request state on main page 2024-03-05 19:44:05 +00:00
delete_test.go all: remove arbitrary hard-coded timeouts in tests 2023-08-23 16:58:07 +00:00
details.go internal/postgres: support module@version exclusions 2024-02-21 20:50:14 +00:00
details_test.go internal/postgres: support module@version exclusions 2024-02-21 20:50:14 +00:00
excluded.go internal/postgres: exclusions should be case insensitive 2024-04-05 14:29:09 +00:00
excluded_test.go internal/postgres: exclusions should be case insensitive 2024-04-05 14:29:09 +00:00
insert_module.go internal/postgres: insert module path even if not a package 2024-09-04 17:48:17 +00:00
insert_module_test.go internal/postgres: insert module path even if not a package 2024-09-04 17:48:17 +00:00
insert_symbol_history.go all: convert interface{} to any 2022-11-15 20:10:34 +00:00
insert_symbol_history_test.go internal/postgres: check symbol history table exists before insert 2021-07-15 14:39:44 +00:00
licenses.go internal/middleware: move stats to its own package 2023-08-04 20:52:42 +00:00
licenses_test.go internal: move UnitMeta.IsRedistributable to Unit 2024-01-23 15:28:52 +00:00
package_symbol.go internal/middleware: move stats to its own package 2023-08-04 20:52:42 +00:00
path.go all: convert interface{} to any 2022-11-15 20:10:34 +00:00
path_test.go internal/{postgres,frontend}: group search results 2021-05-06 13:18:15 +00:00
postgres.go internal/postgres: support module@version exclusions 2024-02-21 20:50:14 +00:00
postgres_test.go all: remove arbitrary hard-coded timeouts in tests 2023-08-23 16:58:07 +00:00
requeue.go internal/config: separate config initialization into serverconfig 2023-08-25 19:08:11 +00:00
requeue_test.go all: remove arbitrary hard-coded timeouts in tests 2023-08-23 16:58:07 +00:00
search.go worker: display request state on main page 2024-03-05 19:44:05 +00:00
search_test.go internal/worker: add batch param to update-imported-by-count route 2024-02-22 22:32:45 +00:00
searchdoc.go all: gofmt 2022-04-11 21:55:57 +00:00
searchdoc_test.go internal/postgres: parallelize tests 2021-02-12 21:24:08 +00:00
stdlib.go internal/database: use generics for Collect functions 2022-03-07 15:51:22 +00:00
stdlib_test.go all: remove arbitrary hard-coded timeouts in tests 2023-08-23 16:58:07 +00:00
symbol.go worker: display request state on main page 2024-03-05 19:44:05 +00:00
symbol_history.go internal/middleware: move stats to its own package 2023-08-04 20:52:42 +00:00
symbol_test.go internal: move UnitMeta.IsRedistributable to Unit 2024-01-23 15:28:52 +00:00
symbolsearch.go worker: display request state on main page 2024-03-05 19:44:05 +00:00
symbolsearch_test.go internal/postgres,tests/search: use filters 2021-09-09 14:55:27 +00:00
test_helper.go all: gofmt 2022-04-11 21:55:57 +00:00
unit.go internal: move UnitMeta.IsRedistributable to Unit 2024-01-23 15:28:52 +00:00
unit_test.go internal: move UnitMeta.IsRedistributable to Unit 2024-01-23 15:28:52 +00:00
version.go internal/middleware: move stats to its own package 2023-08-04 20:52:42 +00:00
version_map.go internal/postgres: add a stack to all wrapped errors 2021-02-12 18:15:20 +00:00
version_map_test.go all: remove arbitrary hard-coded timeouts in tests 2023-08-23 16:58:07 +00:00
version_test.go all: remove arbitrary hard-coded timeouts in tests 2023-08-23 16:58:07 +00:00
versionstate.go worker: display request state on main page 2024-03-05 19:44:05 +00:00
versionstate_test.go all: remove arbitrary hard-coded timeouts in tests 2023-08-23 16:58:07 +00:00