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: search results show incorrect latest version if the latest version of the module and package do not match #41108

Open
Deseao opened this issue Aug 28, 2020 · 5 comments
Assignees
Labels

Comments

@Deseao
Copy link

@Deseao Deseao commented Aug 28, 2020

The search result list for a query will include a Version and Published in the results that may not match the version that will be loaded when following the link due to the most recent module aware version being numerically lower than the +incompatible version that was released before the package converted to support Go modules.

As an example, searching for stripe results in the top result listing "Version: v70.15.0+incompatible | Published: Apr 14, 2020 | Imported by: 1171 | License: MIT"
If you follow the link, the result page is for v1.0.3 with a publication date of Oct 22, 2014.

@gopherbot gopherbot added this to the Unreleased milestone Aug 28, 2020
@cagedmantis cagedmantis changed the title x/pkgsite search results show incorrect Version labels and Published dates. x/pkgsite: search results show incorrect Version labels and Published dates Aug 30, 2020
@cagedmantis
Copy link
Contributor

@cagedmantis cagedmantis commented Aug 30, 2020

@jba jba added NeedsFix and removed NeedsInvestigation labels Aug 30, 2020
@jba jba self-assigned this Aug 30, 2020
@jba
Copy link
Contributor

@jba jba commented Aug 30, 2020

I believe the current state is that the code is in place and deployed, but the search data needs refreshing. Will confirm on Monday.

@julieqiu
Copy link
Contributor

@julieqiu julieqiu commented Aug 31, 2020

The first result for https://pkg.go.dev/search?q=stripe is now fixed. github.com/stripe/stripe-go shows v1.0.3, which matches the latest version on https://pkg.go.dev/github.com/stripe/stripe-go.

The second result, github.com/stripe/stripe-go/form, has a bug that needs to be fixed.

Currently, it shows v70.15.0+incompatible. The latest version of github.com/stripe/stripe-go/form is actually v1.0.4-0.20190107233620-02a95e768d9b, which is shown on https://pkg.go.dev/github.com/stripe/stripe-go/form.

The reason is because the isLatestVersion logic in InsertModule only takes into account the module path, not each individual package path:
https://github.com/golang/pkgsite/blob/master/internal/postgres/insert_module.go#L118

Thanks for filing this @Deseao! We'll work on a fix.

@julieqiu julieqiu modified the milestones: Unreleased, pkgsite/search Aug 31, 2020
@julieqiu julieqiu changed the title x/pkgsite: search results show incorrect Version labels and Published dates x/pkgsite: search results show incorrect latest version if the latest version of the module and package do not match Sep 1, 2020
@bcmills
Copy link
Member

@bcmills bcmills commented Sep 23, 2020

The latest version of github.com/stripe/stripe-go/form is actually v1.0.4-0.20190107233620-02a95e768d9b, which is shown on https://pkg.go.dev/github.com/stripe/stripe-go/form.

Um... The go command resolves both github.com/stripe/stripe-go@latest and github.com/stripe/stripe-go/form@latest to v70.15.0+incompatible, not v1.0.3.

example.com$ go version
go version devel +150bd4ff Wed Sep 23 07:51:17 2020 +0000 linux/amd64

example.com$ go mod init example.com
go: creating new go.mod: module example.com

example.com$ go list -m github.com/stripe/stripe-go@latest
go: downloading github.com/stripe/stripe-go v1.0.3
github.com/stripe/stripe-go v70.15.0+incompatible

example.com$ go get -d github.com/stripe/stripe-go/form@latest
go: downloading github.com/stripe/stripe-go v70.15.0+incompatible
go: found github.com/stripe/stripe-go/form in github.com/stripe/stripe-go v70.15.0+incompatible
@bcmills
Copy link
Member

@bcmills bcmills commented Sep 23, 2020

Note that github.com/stripe/stripe-go has a go.mod discontinuity. Its go.mod file has been added and removed three times; however, because the latest version of that module compatible with semantic import versioning (v1.0.3) lacks an explicit go.mod file, the latest version is considered to be the latest +incompatible release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants