aboutsummaryrefslogtreecommitdiff
path: root/internal/source
AgeCommit message (Collapse)Author
2026-03-26all: run go fix -slicescontainsHana Kim
Change-Id: I14479d9e612dfa7eed9188206746af5b51c10201 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753428 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>
2024-10-01internal/source: support git.glasklar.is URLsGrégoire Détrez
Fixes #69638 Change-Id: I9b595bcc98d2d92895ad3d626981aa551ce75d07 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/609535 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Bypass: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2023-11-07internal/source: move some tests into another packageMichael Matloob
The goal of this CL is to remove the transitive test of cmd/pkgsite on the github.com/google/go-replayers/httpreplay package. The dependency happens through the tests of the source package, so move the test out of the source package into its own package. For golang/go#61399 Change-Id: Ia0d5e4310e25ec0a034cd84f0d5cbcb06b5a75d8 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/538767 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> Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-31all: skip tests that can't run on wasm platformsMichael Matloob
Some because the network support isn't enough for httpreplay, and some because we need the Go command. For golang/go#61209 Change-Id: I02c6b7d10553d931c746723ce9608f39834c131c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/524797 Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-30internal/trace: add a wrapper for tracingMichael Matloob
This package adds a StartSpan function that does nothing unless an implementation for the StartSpan function is injected in. That allows us to have the frontend and worker mains inject the implementation while internal/fetch and internal/source can use the StartSpan function without depending on opencensus's tracing library. For golang/go#61399 Change-Id: I2c650bdbb56c8fcc47ffabab8353cef74e0d1c4e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523739 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-08-29internal/source: inject *http.Client into source.NewClientMichael Matloob
This removes the dependency from package source onto ochttp. The users of source.NewClient that want an ochttp.Transport can set the transport on the *http.Client. For golang/go#61399 Change-Id: Ifb7126c482f664ee5a359f594d9324f0fd90f8b2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523510 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com>
2023-08-23all: remove arbitrary hard-coded timeouts in testsBryan C. Mills
If a test times out, that implies that it got stuck on something. By default, the Go testing package dumps goroutines when its own timeout is passed, which prints a goroutine dump, helping to reveal what was stuck. Adding an arbitrary timeout on top of the testing package's own timeout is, in my experience, almost always counterproductive. If the arbitrary timeout catches a real hang, it causes the test to fail instead of dumping goroutines, making it much harder to see what was stuck. On the other hand, if the timeouts are set aggressively enough to make the test fail early, they are often too aggressive for CI testing, causing flakes that then have to be triaged on an ongoing basis. On balance, the value of saving a minute or two for developers who have introduced a hang is not worth the cost of suppressing debugging information and causing flakes that have to be triaged. Fixes #61556. For #59347. Change-Id: I0263d0d9b18283470f100e5a0155818b87b5312f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/521837 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2023-07-17internal/fetch: add two stdlib gettersMichael Matloob
This breaks out the behavior of getting the stdlib into its own getter, stdlibZipModuleGetter. Most (but not all) of the special cases in the fetch code for the stdlib are in the stdlibZipModuleGetter, which is installed on the frontend. For the local pkgsite command, we add a new builder for the goPackagesModuleGetter that loads the packages from the stdlib given a GOROOT. The stdlibZipModuleGetter is also installed for pkgsite in as a fallback if the goPackagesModuleGetter doesn't successfully fetch the stdlib module (I'm not sure if that's possible). Fixes #60114 Change-Id: Ida6a5367343643cc337c6d05e0d40095f79ca9e5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/507883 Reviewed-by: Jamal Carvalho <jamal@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com>
2023-07-12internal: fix build on WindowsMichael Matloob
Disable some of the vuln tests on windows because one of the path conversion functions fails with an error saying it doesn't work on Windows. Also fix the behavior on windows for /file paths. It looks like they are intended to be /file/+filepath.ToSlash(filesystemPath) when on Windows. Make sure we always generate those paths, and check for those paths. Change-Id: I23738b463b1415f2a75598dab4eaa511791f8e7e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/508503 Run-TryBot: Michael Matloob <matloob@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2023-02-09internal: fix some commentscui fliter
Change-Id: I837c46bba9cd5c012670b432274c6e3318a3275b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/465997 Reviewed-by: Suzy Mueller <suzmue@golang.org> Run-TryBot: Suzy Mueller <suzmue@golang.org> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Auto-Submit: Suzy Mueller <suzmue@golang.org>
2022-06-17many: re-enable staticcheck and fix problemsJonathan Amsterdam
Most of the checks were about io/ioutil. There were a couple of other minor ones. I didn't address the check for strings.Title; instead, I turned off that check globally with a staticcheck.conf file. Change-Id: I286a6894fb1fd891818ab9e451c891f52a3828fc Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/412675 Reviewed-by: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
2022-05-27internal/source: support codebergDaniel Jakots
Change-Id: Iac98a43ac9fd5182eebc154413992db4912e8b28 GitHub-Last-Rev: 3fadfc82655153f93f849e907e3f66e4bb135e0a GitHub-Pull-Request: golang/pkgsite#44 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/401814 Reviewed-by: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Dmitri Shuralyov <dmitshur@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>
2022-01-05internal/source: fix gitlab patternsJonathan Amsterdam
The source patterns for GitLab incorrectly assumed them to be identical to GitHub's. GitLab repos can have multiple path components, and the general path syntax allows for that by placing a "-" path component between the repo and reference. Fixes golang/go#49827 Change-Id: I766c303fb443b80af882931a5bfa151aa3363089 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/375281 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-09-24internal/source: support github.* URLsJonathan Amsterdam
These URLs are used by some GitHub Enterprise Server customers. For golang/go#48542 Change-Id: Iace7e9db14fcb776669c2ae581a7508c188c1aca Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/351276 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-09-07cmd/pkgsite,internal: serve sourceJonathan Amsterdam
- Set up a /files endpoint on the server that can serve files from fs.FS implementations. - Add source.FilesInfo, which returns a source.Info that links to /files paths. Use it to implement the SourceInfo method of the local ModuleGetters. - Add a SourceFS method to the local MethodGetters so they can tell the server how to serve their files. - Improve the tests in cmd/pkgsite to verify the source links. Fixes golang/go#47982 Change-Id: Iff42bad15c4abaf408a364e58b7c0f0dad60b40d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347932 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-06-11internal/source: fix TestModuleInfoJulie Qiu
Change-Id: I4024fc8a4a3f44a62b13e05190b96ac7225dbaa5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/326776 Reviewed-by: Jonathan Amsterdam <jba@google.com> Trust: Julie Qiu <julie@golang.org>
2021-06-10internal/source: change golang.org/* reposJulie Qiu
Rather than using github.com/golang/* for the golang.org/* repos, use cs.googlesource.com/go when available. Change-Id: I88acf4c1316b160b0852ef954a515276e92ad975 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/326190 Trust: Julie Qiu <julie@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-06-10internal/source: replace bitbucket and gitea testsJonathan Amsterdam
Replace two of the three deleted tests. The third deleted test was for git.pirl.io. That site is currently unreachable and we haven't seen a module from it since March, so I'm assuming it's offline. Fixes golang/go#46676 Change-Id: Ib0fcc8f58eeda938dbdf90199185c1424e34613a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/326670 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-06-10internal/source: delete broken URLs in TestModuleInfoJulie Qiu
These tests fail when running TestModuleInfo with -record and are deleted. --- FAIL: TestModuleInfo (76.97s) source_test.go:435: Recording into testdata/TestModuleInfo.replay --- FAIL: TestModuleInfo/vanity_for_bitbucket (1.10s) source_test.go:407: https://bitbucket.org/ivucica/go-glagolitic: 401 Unauthorized --- FAIL: TestModuleInfo/gitea (1.30s) source_test.go:407: https://gitea.com/azhai/xorm: 404 Not Found Change-Id: I2ec516bb85d55a81c40ee5e38ef9aec1396a457a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/326229 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-12internal: change stdlib source repoJulie Qiu
The stdlib source repo is changed to https://cs.opensource.google/go/go. Fixes golang/go#44832 Change-Id: Ie8060ab1cabccbcf9ff20c0eec42c243c1feaf9c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/318873 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2021-05-12internal/source: delete git.pirl.io testJulie Qiu
git.pirl.io/community/pirl no longer exists, so running `go test -run TestModuleInfo -record` will always return a 500 for that path. In order to update internal/source/testdata/TestModuleInfo.replay for future tests, this test is deleted. Change-Id: I8978bb8a725959896c1897e4178a5b8d6f4f51c2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/318969 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-22internal/source: handle blitiri.com.ar import pathsJonathan Amsterdam
The source for these import paths is served by the git-arr web viewer, which doesn't yet handle tags. Until it does, serve the source from master. For golang/go#44607 Change-Id: I94047a887ea6f1038ae812864ad343876b74ff8e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/303609 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-11internal/source: support example.com domain for testingJonathan Amsterdam
For golang/go#44214 Change-Id: I70a3cbfa62cc051949437ecba94b8667d12dff3e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/290896 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-02internal/source: trim .git suffix from repo URLsJonathan Amsterdam
Remove the ".git" from the repo URL of source templates when we know it will result in invalid URLs. The ".git" is understood by the Go command, but not by some code hosting sites. To be safe, only remove it on code hosting sites we've tested. For now, that's GitHub and GitLab. Remove the suffix in three places: 1. When we construct a SourceInfo from the repo URL and meta tags. This will fix newly processed modules. 2. When we unmarshal a SourceInfo from the DB. This will fix it during rendering for already-processed modules. It will save us from having to reprocess or backfill. 3. In the function we use in tests. Fixes golang/go#44032 Change-Id: Ic6d48d0422dc12ce8dbc4586f8d6c586f463531e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/288612 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-01-21internal/source: match old templates to find new onesJonathan Amsterdam
Previously, when we encountered a repo whose URL doesn't match an existing pattern, we did not generate any URL templates for it, meaning we could not render source links in the documentation. This CL uses the templates in the go-source meta tag to guess the version-aware templates that are likely to work for the repo. For golang/go#40477 Change-Id: I2d1978da5a6de1af19284233dbab9ac1ae2cb582 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/285312 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2020-12-22internal/source: enable testing without HTTP requestsJonathan Amsterdam
Add NewClientForTesting, which returns a Client that does not make any HTTP requests. The practical effect is to eliminate a lot of errors from test logs in the internal/fetch package. Change-Id: Ie47ceb1a8984d4408ea361baefa1610aeed1b02a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/279793 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-15internal/source,stdlib: change stdlib source repo to go.googlesource.comJonathan Amsterdam
Link to source files in the canonical Go repo, go.googlesource.com/go. Continue to serve raw content (for images) from the GitHub mirror, since we can't from googlesource.com. Fixes golang/go#43180 Change-Id: Iac513d6481bcdb73ae73eed40d33518ffd3a0158 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/278293 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-12-04internal/source: update gitea commentJonathan Amsterdam
For golang/go#39559 Change-Id: Id9c2ae0bcac9299565695d79a66f4bf591e60364 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/274956 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-09-30internal/source: fix documentationJulie Qiu
source.ModuleInfo is incorrectly documented as source.LegacyModuleInfo, which is now fixed. A comment in RawURL is also fixed. For golang/go#39629 Change-Id: I30b650f2895970e36446659a02a6f3e8e54ef578 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258301 Reviewed-by: Jamal Carvalho <jamal@golang.org> Trust: Julie Qiu <julie@golang.org>
2020-08-28internal/source: add support for dmitri.shuralyov.com/... packagesDmitri Shuralyov
Add support for a set of packages that defer to another website to display their source code. To be able to produce expected URLs, we need to add two more URL template variables: • {importPath} - Package import path ("example.com/myrepo/mypkg"). • {base} - Base name of file containing the identifier, including file extension ("file.go"). Also add a new optional Repo URL template for overriding the home page of the repository, which is something that was possible with the original go-source meta tag. Document the existing URL template variables, so that it's easier to understand how to use them. For golang/go#40477. Change-Id: I70b857155f69c5c3ed41e78daccb90153a927290 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/246239 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-07-29internal/source: tweak commentsJonathan Amsterdam
Change-Id: Id5871a052193a32a90be7f6fd1d199807049bc28 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245381 Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-29internal/source: support some more URLsJonathan Amsterdam
Change-Id: I23b20b711ac892a86e0a8bdceccacef6f4665191 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245380 Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-29internal/source: support gitea.* URLsJonathan Amsterdam
Treat any repo URL beginning with "gitea." as if it uses the Gitea system. Also, sanity-check templates and fix some bugs. Change-Id: Ib6c3ca028d57e05504faef4bfdf6aa4439525fb7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245379 Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-28internal/source: support more code-hosting sitesJonathan Amsterdam
Suport git.fd.io, fit.pirl.io, and gitea. For golang/go#39019 Change-Id: I4e4fbf617598435803d209fc6150b7c8e56a0f72 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245259 Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-28internal/source: remove incorrect commentsJonathan Amsterdam
Change-Id: Ia8c1a67608fe334de11da8366920fe36211cbe85 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245258 Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-28internal/source: simplify pattern specificationJonathan Amsterdam
Allow regexps to be specified as strings. Change-Id: Icad485e0ec798a99691c002754bc104526e48a84 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245257 Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-28internal/source: add sourcehut templatesJonathan Amsterdam
Add source templates for the sourcehut git hosting site (git.sr.ht). Fixes golang/go#38986. Change-Id: I581389affe3c777828189d8aa35e3910ffe1d130 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245039 Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-27internal/source: remove extraneous commentsJonathan Amsterdam
It's not important whether certain patterns are part of the go command or not. Change-Id: I8e921b0f2256efa419b3df41a9d1925cb0fa8cd7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245037 Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-21internal/source: remove HTML escapingJonathan Amsterdam
Now that the entire server uses safehtml, it is no longer necessary to do anything special with the user-provided values in this package. Every use of the Info.XXXURL methods is part of rendering a safe template, so all the escaping will happen then. Change-Id: I5e64b08d4c7b8e7fd56cf1a0bed49691f2a8ee82 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242917 Reviewed-by: Julie Qiu <julie@golang.org>
2020-07-17internal/source: use better github raw templateJonathan Amsterdam
Replace the previous github template for raw data (raw.githubusercontent...) with a new one that is more uniform (the same as the blob template, with "raw" instead of "blob"). The main advantage is that we can drop the "repoPath" parameter to the template, which was necessary only to support the unusual GitHub URLs. Now that GitHub and GitLab templates are identical, we can drop the GitLab ones. We preserve "gitlab" in the map from kinds to templates so we can continue to unmarshal DB modules.source_info columns that use "gitlab". Change-Id: Id3d45929f0eb2c040109449d4208279cca44f079 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/243217 Reviewed-by: Julie Qiu <julie@golang.org>
2020-06-30internal/fetch/dochtml: update package documentation and issue numbersDmitri Shuralyov
There has been progress made since the package comments were written. Update them to reflect the current state. For golang/go#39621. Change-Id: I3f950428a96bc0561b45b0d49117d2eda58d3cf7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/240187 Reviewed-by: Julie Qiu <julie@golang.org>
2020-06-23internal/{source,frontend}: escape HTMLJonathan Amsterdam
Escape any strings that may come from outside the program and will be rendered as HTML. Also, fix some typos. Also, put args to a cmp.Diff call in the right order. Change-Id: I1fc6013e200326af8719b14c28a607fc7936e20a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/239478 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-15internal/source: really use replay client for testJonathan Amsterdam
We were creating a reply client, but not passing it in, so TestModuleInfo was actually hitting the internet. Fixes b/158850091. Change-Id: I4e981299a538750cb519c441e05805b29c7925a8 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/769682 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>
2020-05-28internal/source: update testsJonathan Amsterdam
Running with `go test -record` revealed some 404s (pages that used to exist but no longer do). I replaced them with similar pages. Change-Id: I6903229e8221923e22338bdae3f112308aecd19e Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/756267 CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com> Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-29internal: add traces fetch processJulie Qiu
Additional traces are added to the fetch process so that we can get more detailed information on what is taking up time in a fetch process. Change-Id: I8f74a0d2117a18002d64453d222cb08a1fb81ff2 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/729482 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-23all: rename module to golang.org/x/pkgsiteJulie Qiu
golang.org/x/discovery is renamed to golang.org/x/pkgsite. When the repository is open sourced, it will be hosted at go.googlesource.com/pkgsite. Change-Id: Ifc3b45b771a385b99179e785447f2a87afcacf87 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/724273 Reviewed-by: Jonathan Amsterdam <jba@google.com>