aboutsummaryrefslogtreecommitdiff
path: root/cmd/pkgsite
AgeCommit message (Collapse)Author
13 hours[DO-NOT-MERGE] all: add option shutdown-idleHEADmainShulhan
The shutdown-idle set the duration to automatically shutdown the HTTP server when no request after specific duration. This is to complement the socket based activation to minimize the resources on local environment.
13 hours[DO-NOT-MERGE] cmd/pkgsite: implement socket based activationShulhan
2025-12-22internal/dcensus: add metrics for codewiki link usageEthan Lee
- Count link usage, target url and referrer page. - To avoid increasing dependency size, use indirection to call recordCodeWikiMetrics. Example: Run `go run ./cmd/frontend/main.go -dev -direct_proxy` and access pkgsite via localhost:8080. After clicking on the link, observe the relevant metric logged in localhost:8081/statz. Run `go test -v -run TestCmdPkgsiteDeps` to ensure that cmd/pkgsite dependencies remain stable. Change-Id: Ib312584162b81deac4c22b4ed923ff783133e11e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/731020 Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> Auto-Submit: Ethan Lee <ethanalee@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-04-14cmd/pkgsite: indent command so it appears as preformatted textAdam Bender
This matches the other commands in the file. go/doc does not support backticks. Change-Id: Ief7366feaf9c1bc31bbc793d04e61681a21482db Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/664735 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Sean Liao <sean@liao.dev> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-05all: fix printf(var) mistake detected by latest printf checkerTim King
For golang/go#69267. Change-Id: I050c167e2e3ce36541e0d71469fb3f5778f5a882 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/610517 Reviewed-by: Ian Lance Taylor <iant@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-24cmd/pkgsite: fix setting gorepo flagMichael Matloob
The value of the gorepo flag variable was being used before flags were parsed. Fix that. Also fix a couple of other issues that came up in golang/go#68533: First, don't print "searching GOPATH" when we're not searching GOPATH. Second, print the stderr from the go command in the error when it fails because it's the stderr that usually provides information about the failure, not the stdout. For golang/go#68533 Change-Id: Ic6321d6e071dd82415474f2a2c54146e9eabbef7 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/600917 Reviewed-by: Jonathan Amsterdam <jba@google.com> Auto-Submit: Michael Matloob <matloob@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2024-02-07cmd: split the cmd/pkgsite server building logic to a new packageMichael Matloob
This will allow us to create a separate binary (probably called cmd/pkgdoc) that will be started by "go doc" to serve pkgsite. The separate binary can have different flags and options. Change-Id: Ie8c2cdce4c850c9f787db12679c872f279c435ad Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/561340 kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> 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> TryBot-Result: Gopher Robot <gobot@golang.org>
2024-01-08cmd/pkgsite: fix case where we don't have runtime.GOROOT()Michael Matloob
If pkgsite is built with -trimpath, runtime.GOROOT() returns an empty string, so we don't know where the local go stdlib is. In that case, don't try to serve a local stdlib and instead fall back to the stdlibZipModuleGetter. Also fix two issues that show up when using the stdlibZipModuleGetter. First, we try to prefetch fetch.LocalVersion of the standard library when the server starts. Instead, prefetch latest which will have the correct behavior with both the stdlib zips and local stdlib. Second, when we're trying to fetch the stdlib using git make sure that we're on another branch than the one we're trying to fetch into because git won't let us fetch into the branch we're on. Fixes golang/go#64903 Change-Id: I9dfb22d50b7738080490ce2682e0cf187c16d2d1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/554195 TryBot-Bypass: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-12-21cmd/pkgsite,internal/fetch: improve startup experienceMichael Matloob
When a user tries to look at the documentation for a unit for the first time, we process all the packages in the module. Kick off goroutines to do that so that the modules' packages might be processed by the time the user sees them. Also parallelize processing the packages in the module. That brings processing std from about 8 seconds to about 3 seconds. Change-Id: I505979d682897d2d1e55ce9e123e3ff4d1fb0e70 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/551776 kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
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-29internal/proxy: inject transport in proxy.NewMichael Matloob
This removes the dependency from internal/proxy on ochttp. For golang/go#61399 Change-Id: Ib2a350151752dc18c9a6e03b38b2d423ed55f4a1 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/523513 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
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-25cmd/frontend: move typescript compile watching into mainMichael Matloob
To remove the dependency from cmd/pkgsite on to github.com/evanw/esbuild, this change moves the code that starts the watcher for recompiling typescript files into cmd/frontend. This means the dev mode functionality in cmd/pkgsite for watching and recompiling typescript files is gone. For golang/go#61399 Change-Id: If1325461de30dfd2f71b63d810cab8e9b4cdeb06 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/522735 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com>
2023-08-10cmd/pkgsite: more changes to use local stdlibMichael Matloob
This cl makes more changes to enable using the local stdlib. It always uses the local stdlib from cmd/pkgsite. It also changes code that processes and shows versions to expect and pass through v0.0.0, the fake version we use when we show local packages. For #57742 Change-Id: Ic407e58e9658b0703dbc6df47f40bbe1f1bd2b2a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/517915 kokoro-CI: kokoro <noreply+kokoro@google.com> Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-31internal/middleware: move the timeout middleware to its own packageMichael Matloob
This removes the direct dependency from cmd/pkgsite to the middleware package. The middleware package has a lot of dependencies but most middlewares are not used by cmd/pkgsite. There are still some middlewares used by internal/frontend so the indirect dependency still exists. For #61399 Change-Id: I09eee46b2ff13e112d24df62073074eb5aa3e901 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/511315 Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Jamal Carvalho <jamal@golang.org> kokoro-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@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-13README.md: make `pkgsite` more discoverableHana (Hyang-Ah) Kim
And update the installation instruction. Change-Id: I950f2a990ccddbc775b59b51b2b667ab40977237 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/509416 Reviewed-by: Jamal Carvalho <jamal@golang.org> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Bypass: Hyang-Ah Hana Kim <hyangah@gmail.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-05-12x/pkgsite: add -open to open browserSteven Hartland
Add -open command line flag to cmd/pkgsite which tries to open a browser to the newly running server. This provides a simple way to open a browser to pkgsite service without having do paste the URL into a browser manually. It leverages the internal/browser package from go for this functionality as used by go tool cover -html. Fixes golang/go#60002 Change-Id: I94ba4cde2aa0830630bf0e9d7710414db9801606 GitHub-Last-Rev: 4e4f3cd79b94c7301e7ef563c65b6ca2551d536d GitHub-Pull-Request: golang/pkgsite#64 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/493075 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
2023-03-15cmd/pkgsite: hide irrelevant content in local mode; add quick linksRobert Findley
This CL contains several UI improvements when running pkgsite in local mode via cmd/pkgsite: - hide irrelevant or inaccurate content - fix a bug using -gopath_mode (trim the `go env GOPATH` output) - fix panics navigating to vuln pages - link the GO button to the root page, rather than go.dev - add quick-links to the homepage to browse local modules Also: - add -dev and -static flags, to facilitate development - replace TestBuildGetters with more cases in TestServer - fix some redundancy in setting the <title> element for pages; consolidate on using the basePage.HTMLTitle value Updates golang/go#40371 Change-Id: I459a0d0fd39897dd4f902dd023aec653a3fb12cd Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/475755 TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> Run-TryBot: Robert Findley <rfindley@google.com>
2023-03-14cmd/pkgsite: add multi-module support, invalidation, and searchRobert Findley
This change adds a new goPackagesModuleGetter, which uses x/tools/go/packages to query package information for modules requested by the pkgsite command. Additionally, add new extension interfaces that allow getters to add support for search and content invalidation. The go/packages getter uses these extensions to implement search (via a simple fuzzy-matching algorithm copied from x/tools), and invalidation via statting package files. Along the way, refactor slightly for testing ergonomics. Updates golang/go#40371 Updates golang/go#50229 Fixes golang/go#54479 Change-Id: Iea91a4d6327707733cbbc4f74a9d93052f33e295 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/474295 TryBot-Result: kokoro <noreply+kokoro@google.com> Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
2022-11-15all: convert interface{} to anyHana (Hyang-Ah) Kim
Change-Id: I1f3b7cc8899c7707abb01e3d14807c37c3451382 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/449695 TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
2022-08-26cmd/pkgsite: list modules read-onlyJonathan Amsterdam
Add -mod=readonly to the `go list` command that is run so the command will work with vendor directories. Change-Id: I5baa4b93f29f2c760d2fed03a3ea29f8382002f3 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/425494 Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@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-06-14cmd/pkgsite: ignore indirect modulesJonathan Amsterdam
When `go list -m` lists an indirect module, there is no GoMod path. This was confusing the pkgsite command, because it assumed there was one. Since `go list` doesn't provide enough information to serve indirect modules, ignore them. Fixes golang/go#53323 Change-Id: I0ff9658ee286b2f11dabf76d1bf5f65a9c16ed42 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/412058 Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@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-02-17cmd/pkgsite: refactor and add testJonathan Amsterdam
Create all the getters in one place so we can test that. Change-Id: I748a823562ee6e247ea9eece8e77d65bc68d68d4 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/386195 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>
2022-02-16cmd/pkgsite: serve modules from the build listJonathan Amsterdam
Instead of serving just the module at a given path, serve all the modules on its build list too (the result of go list -m all). Change-Id: Ibd899d0a7bf23abd3e81882c2a1a62f2f63570a2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/386194 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>
2022-02-16cmd/pkgsite: remove -static flagJonathan Amsterdam
Change-Id: I63ea8fbe28c2e00776b295128ce945df65dec7b9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/386074 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-11-08cmd/pkgsite: make listening addr link clickableAmelia Downs
Adds the "http" protocol to the beginning of the address so you can click it from your terminal. Change-Id: I7106717b1a9ad59bf75f2e9cb7882407f3211470 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/360479 Reviewed-by: Julie Qiu <julie@golang.org> Trust: Julie Qiu <julie@golang.org> Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com>
2021-10-28many: cmd/pkgsite embeds static assetsJonathan Amsterdam
The `pkgsite` command now embeds all the static assets it needs, so it need not be told the location of the static/ directory with a flag. The binary is self-contained and can be placed and invoked from anywhere. This required embedding the static/ and third_party/ directories. Since //go:embed cannot reference files outside the containing package's tree, we had to add trivial Go packages in static/ and third_party/ to construct `embed.FS`s for those directories. Also, the frontend needed to accept `fs.FS` values where it previously took paths, and `template.TrustedFS` values where it previously used `template.TrustedSources`. We ended up clumsily requiring four separate config values: - A TrustedFS to load templates. - Two fs.FSs, one for static and one for third_party, to load other assets. - The path to the static directory as a string, solely to support dynamic loading in dev mode. For golang/go#48410 Change-Id: I9eeb351b1c6f23444b9e65b60f2a1d3905d59ef9 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/359395 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org> 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-09-07internal/fetch: use modcache dir for cache getterJonathan Amsterdam
A minor change to the ModuleGetter for the module cache: it now takes the cache directory itself, not the cache/download subdirectory. This will facilitate serving source. For golang/go#47982 Change-Id: I646471297e38de686586f2180608fc32cb59496d Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347930 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-09-07internal/fetch: reorganize testdata directoryJonathan Amsterdam
The modcache subdirectory did not correctly resemble a true module cache. Move the proxy part into a cache/download subdirectory, and expand one module zip, since we'll be serving source from the expanded files, not the zip. For golang/go#47982 Change-Id: Ib5d49f67d2e7a47f8763958d28f44861aea9296b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347929 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-09-07internal/fetch: get source info from module getterJonathan Amsterdam
Make it the ModuleGetter's responsibility to provide links to source files, instead of passing around a separate source.Client. This will allow getters that fetch from disk to serve those local files. For golang/go#47982 Change-Id: I6c7cd7890b03ad61d9410850a510c1c9a63f1c9a Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347749 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-09-03cmd/pkgsite: use local Go repo cloneJonathan Amsterdam
Add the -gorepo flag, which lets the user specify a local clone of the Go repo. This can save a little time serving standard library pages. Change-Id: Ic8f436b8ba3494dc51db7593b20613724faab9e5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/347549 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>
2021-09-01cmd/pkgsite: remove dcensusJonathan Amsterdam
Since the fetch code no longer records metrics, the pkgsite command doesn't need to talk to OpenCensus. For golang/go#48010 Change-Id: I2793046725cd8c66ddfb585370ba2bf4890a9366 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/346810 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-09-01cmd/pkgsite: improve ergonomicsJonathan Amsterdam
- Improve the help message. - Describe the usage in more detail in the package comment. - With -cache or -proxy, don't try to load the current directory. Change-Id: I202c5251a0457635f1fc01321ae339953f4b4319 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/345690 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-08-26internal/fetch: support latest version in modcache getterJonathan Amsterdam
If the fsProxyModuleGetter is asked for the latest version, it finds it by looking at the versions of all the cached zips for the module. For golang/go#47780 Change-Id: I6e0b1f51c994e99bbcf3e66f40ef4c504fe48ce8 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/345273 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-08-26cmd/pkgsite: support the module cacheJonathan Amsterdam
With the -cache flag, fetch modules from the module cache. For golang/go#47780 Change-Id: I2aa6467955cd90a80ccae559f27928cca6e06079 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/345272 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-08-26cmd/pkgsite: support proxyJonathan Amsterdam
If the -proxy flag is provided, the pkgsite command will fetch modules from the proxy if they can't be found locally. For golang/go#47780 Change-Id: I02b9fddac9013d9d3859b78e6c8887282469c9a8 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/345271 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-08-26cmd/pkgsite: accept space-separated paths tooJonathan Amsterdam
Treat any command-line argument as a path or comma-separated list of paths. For golang/go#47780 Change-Id: I5d9044d3ff0e14af99c4632f3c723039179a94a5 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/345270 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
2021-08-25internal/fetchdatasource: rename from datasourceJonathan Amsterdam
Rename the package and type by including the word "fetch," to describe what it does and distinguish it from other DataSources. For golang/go#47780 Change-Id: I7c674d8ba3dc16084a857039b0cc2b3147f27a29 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/344953 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-08-25internal/datasource: consolidateJonathan Amsterdam
Merge ProxyDataSource and LocalDataSource into a single type, DataSource. Combine and simplify tests. For golang/go#47780 Change-Id: I3510fee3a3d786705a2306a6233b352e5af40076 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/344952 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-08-24internal/datasource: factor out gettersJonathan Amsterdam
Move the list of getters into the common dataSource implementation. Also, have the constructor take the list getters initially. It simplifies the state of the dataSource (no chance of someone adding a getter after some modules have been fetched). For golang/go#47780 Change-Id: I08b005da13b7bd1ad784ceaf30d722da634009b2 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/344669 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-08-24internal/datasource: combine datasource packagesJonathan Amsterdam
The proxy and local datasource implementations can share a lot of code. Put them in the same package to facilitate that. For golang/go#47780 Change-Id: Ic67d647decd7056650120d47fba9f2351426142b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/344530 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-08-20cmd/pkgsite: add a testJonathan Amsterdam
Add a small test to the pkgsite command to make sure it's working. For golang/go#47780 Change-Id: I276feeacbc11b18ceb054902fe6b0c1c2c2ab923 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/343630 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-08-19internal/localdatasource: use gettersJonathan Amsterdam
Instead of loading a list of modules initially, a local datasource now takes a list of ModuleGetters, which are called on demand when a module is requested. For golang/go#47780 Change-Id: Ica3cc6d47de01ec78c451c0ef54b9ba0e0c5a96e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/343591 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-12internal: switch static reads from content/static to staticJamal Carvalho
Change-Id: Icec167d645b9178375b959491206277e13b455cf Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/327283 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Julie Qiu <julie@golang.org>
2021-02-22cmd/pkgsite: use working directory if no paths are givenZyad A. Ali
Change-Id: I3cbfa392e52dab94bc01011f793f22c5990e9cb0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/295171 Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Julie Qiu <julie@golang.org> Trust: Jamal Carvalho <jamal@golang.org>