diff options
| author | Julie Qiu <julie@golang.org> | 2021-01-31 22:06:02 -0500 |
|---|---|---|
| committer | Julie Qiu <julie@golang.org> | 2021-02-12 21:21:49 +0000 |
| commit | 84574e5b8d2668d5f07f7bb7ee8ae19b7dfd22c3 (patch) | |
| tree | b8899f1ea02590b019c7ab211f03088c135d7388 /internal/postgres | |
| parent | f8709641a5977032e1529f9f642a864e31c2604c (diff) | |
| download | go-x-pkgsite-84574e5b8d2668d5f07f7bb7ee8ae19b7dfd22c3.tar.xz | |
content,internal: update versions page
The versions page is updated to:
- Display incompatible versions in a separate section
- Remove minor versions of other modules
A version.IsIncompatible function is added to the internal/version package for determining
if a version is an incompatible version.
Mock: https://photos.app.goo.gl/wWEFsMrmtaxggTAk7
Change-Id: I9a1c533066c3ea8b3f9f9b65f9bd171290655b5e
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/288762
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>
Diffstat (limited to 'internal/postgres')
| -rw-r--r-- | internal/postgres/insert_module.go | 8 | ||||
| -rw-r--r-- | internal/postgres/versionstate.go | 4 |
2 files changed, 3 insertions, 9 deletions
diff --git a/internal/postgres/insert_module.go b/internal/postgres/insert_module.go index 8d68bece..1d979a84 100644 --- a/internal/postgres/insert_module.go +++ b/internal/postgres/insert_module.go @@ -205,7 +205,7 @@ func insertModule(ctx context.Context, db *database.DB, m *internal.Module) (_ i m.IsRedistributable, m.HasGoMod, m.DeprecatedComment, - isIncompatible(m.Version), + version.IsIncompatible(m.Version), ).Scan(&moduleID) if err != nil { return 0, err @@ -581,12 +581,6 @@ func lock(ctx context.Context, tx *database.DB, modulePath string) (err error) { return nil } -// isIncompatible reports whether the build metadata of the version is -// "+incompatible", https://semver.org clause 10. -func isIncompatible(version string) bool { - return strings.HasSuffix(version, "+incompatible") -} - // isLatestVersion reports whether version is the latest version of the module. func isLatestVersion(ctx context.Context, ddb *database.DB, modulePath, resolvedVersion string) (_ bool, err error) { defer derrors.WrapStack(&err, "isLatestVersion(ctx, tx, %q)", modulePath) diff --git a/internal/postgres/versionstate.go b/internal/postgres/versionstate.go index 1674005d..e91ca58b 100644 --- a/internal/postgres/versionstate.go +++ b/internal/postgres/versionstate.go @@ -27,7 +27,7 @@ func (db *DB) InsertIndexVersions(ctx context.Context, versions []*internal.Inde var vals []interface{} for _, v := range versions { - vals = append(vals, v.Path, v.Version, version.ForSorting(v.Version), v.Timestamp, 0, "", "", isIncompatible(v.Version)) + vals = append(vals, v.Path, v.Version, version.ForSorting(v.Version), v.Timestamp, 0, "", "", version.IsIncompatible(v.Version)) } cols := []string{"module_path", "version", "sort_version", "index_timestamp", "status", "error", "go_mod_path", "incompatible"} conflictAction := ` @@ -116,7 +116,7 @@ func upsertModuleVersionState(ctx context.Context, db *database.DB, modulePath, CURRENT_TIMESTAMP + INTERVAL '1 hour' END;`, modulePath, vers, version.ForSorting(vers), - appVersion, timestamp, status, goModPath, sqlErrorMsg, numPackages, isIncompatible(vers)) + appVersion, timestamp, status, goModPath, sqlErrorMsg, numPackages, version.IsIncompatible(vers)) if err != nil { return err } |
