Source File
build_context.go
Belonging Package
golang.org/x/pkgsite/internal
package internal
import
type BuildContext struct {
GOOS, GOARCH string
}
func ( BuildContext) ( BuildContext) bool {
:= func(, string) bool { return == "" || == All || == }
return (.GOOS, .GOOS) && (.GOARCH, .GOARCH)
}
const All = "all"
var (
BuildContextAll = BuildContext{All, All}
BuildContextLinux = BuildContext{"linux", "amd64"}
BuildContextWindows = BuildContext{"windows", "amd64"}
BuildContextDarwin = BuildContext{"darwin", "amd64"}
BuildContextJS = BuildContext{"js", "wasm"}
)
func (, BuildContext) int {
if == {
return 0
if == BuildContextAll {
if == BuildContextAll {
return 0
}
return -1
}
if == BuildContextAll {
return 1
}
:= func( BuildContext) int {
for , := range BuildContexts {
if == {
return
}
}
return len(BuildContexts) // unknowns sort last
}
return () - ()
}
func ( *Documentation) () BuildContext {
return BuildContext{GOOS: .GOOS, GOARCH: .GOARCH}
}
func ( []*Documentation, BuildContext) *Documentation {
for , := range {
if .Match(BuildContext{.GOOS, .GOARCH}) {
return
}
}
return nil
![]() |
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. |