Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/pkgsite: support viewing a module at a specific git commit #48100

Open
mvdan opened this issue Aug 31, 2021 · 0 comments
Open

x/pkgsite: support viewing a module at a specific git commit #48100

mvdan opened this issue Aug 31, 2021 · 0 comments
Labels
FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite

Comments

@mvdan
Copy link
Member

mvdan commented Aug 31, 2021

As far as I can tell, pkgsite supports viewing a package at three versions via https://pkg.go.dev/some-module@some-version:

  • The default, @latest
  • @master, which works on git as the "latest development" branch of many git repos
  • Specific Go module versions, like @v1.2.3 or v3.4.0-0.dev.0.20210826165642-ec61336f424e

go list -m some-module@some-version supports all three, plus any version known to the VCS repository. For example:

$ go list -m mvdan.cc/sh/v3@ec61336f4 # short git commit
mvdan.cc/sh/v3 v3.4.0-0.dev.0.20210826165642-ec61336f424e
$ go list -m mvdan.cc/sh/v3@fuzz-corpus # git branch
mvdan.cc/sh/v3 v3.4.0-0.dev.0.20210523164001-ed686c72b3ae

I'm running with the default GOPROXY and an empty GOPRIVATE, and it seems like these simply go via proxy.golang.org:

The feature request for arbitrary branches is already at #46914. This issue is about the other scenario: specific commits from the VCS. The main difference with branches is that, by definition, branches are a moving target. Specific commits are more like tags: they should generally be treated as immutable once published.

My particular use case today is similar to arbitrary branches; imagine I've pushed a new feature to a feature branch in the upstream git repo, and I want to check that pkgsite renders it well and the docs make sense. I might also want to share the link as part of a PR to allow easier review.

Right now I can do it manually via this monstrosity of a hack:

$ firefox "https://pkg.go.dev/github.com/ipld/go-ipld-prime@$(go list -m -f {{.Version}} github.com/ipld/go-ipld-prime@eba8e5653ba2e418866c0c51b292e7bd4e9c080b)"

Essentially, using go list -m to turn a git commit into the Go pseudo-version, then using that as the version suffix in the pkgsite URL.

It would be much better UX if pkgsite did this for me, just like go list -m does, and especially seeing how the proxy server already has the support.

@gopherbot gopherbot added this to the Unreleased milestone Aug 31, 2021
@jamalc jamalc modified the milestones: Unreleased, pkgsite/unplanned Sep 1, 2021
@jamalc jamalc added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Projects
None yet
Development

No branches or pull requests

4 participants