Source File
versions.go
Belonging Package
golang.org/x/pkgsite/internal/frontend
package frontend
import (
)
OtherModules []string
}
type VersionList struct {
Versions []*VersionSummary
}
type VersionSummary struct {
return nil, proxydatasourceNotSupportedErr()
}
, := .GetVersionsForPath(, )
if != nil {
return nil,
}
:= internal.NewSymbolHistory()
if == stdlib.ModulePath || experiment.IsActive(, internal.ExperimentSymbolHistoryVersionsPage) {
, = .GetSymbolHistory(, , )
if != nil {
return nil,
}
}
var string
if .ModulePath == stdlib.ModulePath {
=
} else {
= pathInVersion(internal.V1Path(, ), )
}
return constructUnitURL(, .ModulePath, linkVersion(.Version, .ModulePath))
}
return buildVersionDetails(, , , ), nil
}
func ( string, *internal.ModuleInfo) string {
:= internal.Suffix(, .SeriesPath())
if == "" {
return .ModulePath
}
return path.Join(.ModulePath, )
}
func ( string,
[]*internal.ModuleInfo,
*internal.SymbolHistory,
var []VersionListKey
:= semver.Major(.Version)
if .ModulePath == stdlib.ModulePath {
var error
, = stdlib.MajorVersionForVersion(.Version)
if != nil {
panic()
}
:= internal.MajorVersionForModule(.ModulePath)
if != "" {
=
} else if version.IsIncompatible(.Version) {
= semver.Major(.Version)
} else if != "v0" && !strings.HasPrefix(, "go") {
= "v1"
}
:= VersionListKey{
ModulePath: .ModulePath,
Major: ,
Incompatible: version.IsIncompatible(.Version),
}
:= &VersionSummary{
Link: (),
CommitTime: absoluteTime(.CommitTime),
Version: linkVersion(.Version, .ModulePath),
IsMinor: isMinor(.Version),
}
.Deprecated = .Deprecated
.DeprecationComment = shortRationale(.DeprecationComment)
.Retracted = .Retracted
.RetractionRationale = shortRationale(.RetractionRationale)
if := .SymbolsAtVersion(.Version); != nil {
.Symbols = symbolsForVersion((), )
}
if , := []; ! {
= append(, )
}
[] = append([], )
}
var VersionsDetails
:= map[string]bool{}
for , := range {
:= &VersionList{
VersionListKey: ,
Versions: [],
}
if .ModulePath == {
if .Incompatible {
.IncompatibleModules = append(.IncompatibleModules, )
} else {
.ThisModule = append(.ThisModule, )
}
} else {
[.ModulePath] = true
}
}
for := range {
.OtherModules = append(.OtherModules, )
sort.Strings(.OtherModules)
return &
}
return false
}
if == version.TypePrerelease || == version.TypePseudo {
return false
}
return strings.HasSuffix(strings.TrimPrefix(, semver.MajorMinor()), ".0")
}
return [:-3] + "..."
}
:= shorten(pseudoVersionRev(), 7)
:= shorten(pseudoVersionBase(), 15)
return fmt.Sprintf("%s...-%s", , )
}
return
}
func ( string, string) string {
if == stdlib.ModulePath {
if strings.HasPrefix(, "v0.0.0") {
return strings.Split(, "-")[2]
}
return goTagForVersion()
}
return formatVersion()
}
func ( string, string) string {
if == stdlib.ModulePath {
if strings.HasPrefix(, "go") {
return
}
return goTagForVersion()
}
return
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |