Source File
tabs.go
Belonging Package
golang.org/x/pkgsite/internal/frontend
package frontend
import (
)
Disabled bool
}
const (
tabMain = ""
tabVersions = "versions"
tabImports = "imports"
tabImportedBy = "importedby"
tabLicenses = "licenses"
)
var (
unitTabs = []TabSettings{
{
Name: tabMain,
TemplateName: "unit_details.tmpl",
},
{
Name: tabVersions,
TemplateName: "unit_versions.tmpl",
},
{
Name: tabImports,
TemplateName: "unit_imports.tmpl",
},
{
Name: tabImportedBy,
TemplateName: "unit_importedby.tmpl",
},
{
Name: tabLicenses,
TemplateName: "unit_licenses.tmpl",
},
}
unitTabLookup = make(map[string]TabSettings, len(unitTabs))
)
func () {
for , := range unitTabs {
unitTabLookup[.Name] =
}
}
func ( context.Context, *http.Request, string, internal.DataSource, *internal.UnitMeta, internal.BuildContext) ( interface{}, error) {
defer derrors.Wrap(&, "fetchDetailsForUnit(r, %q, ds, um=%q,%q,%q)", , .Path, .ModulePath, .Version)
switch {
case tabMain:
, := .URL.Query()["readme"]
return fetchMainDetails(, , , , )
case tabVersions:
return fetchVersionsDetails(, , .Path, .ModulePath)
case tabImports:
return fetchImportsDetails(, , .Path, .ModulePath, .Version)
case tabImportedBy:
return fetchImportedByDetails(, , .Path, .ModulePath)
case tabLicenses:
return fetchLicensesDetails(, , )
}
return nil, fmt.Errorf("BUG: unable to fetch details: unknown tab %q", )
![]() |
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. |