Documentation
¶
Overview ¶
Package platform is a utility for handling platform data
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Platform ¶
Platform holds an os/architecture pair.
func CurrentPlatform ¶
func CurrentPlatform() Platform
CurrentPlatform returns the platform defined by GOOS and GOARCH.
func (Platform) Equals ¶
Equals is an equality test between this platform and the other.
Example ¶
package main
import (
"fmt"
"github.com/cloudfoundry/cloud-service-broker/v2/internal/brokerpak/platform"
)
func main() {
p := platform.Platform{Os: "beos", Arch: "webasm"}
fmt.Println(p.Equals(p))
fmt.Println(p.Equals(platform.CurrentPlatform()))
}
Output: true false
func (Platform) MatchesCurrent ¶
MatchesCurrent returns true if the platform matches this binary's GOOS/GOARCH combination.
Example ¶
package main
import (
"fmt"
"github.com/cloudfoundry/cloud-service-broker/v2/internal/brokerpak/platform"
)
func main() {
fmt.Println(platform.CurrentPlatform().MatchesCurrent())
}
Output: true
func (Platform) String ¶
String formats the platform as an os/arch pair.
Example ¶
package main
import (
"fmt"
"github.com/cloudfoundry/cloud-service-broker/v2/internal/brokerpak/platform"
)
func main() {
p := platform.Platform{Os: "bsd", Arch: "amd64"}
fmt.Println(p.String())
}
Output: bsd/amd64
func (Platform) Validate ¶
func (p Platform) Validate() (errs *validation.FieldError)
Validate implements validation.Validatable.
Click to show internal directories.
Click to hide internal directories.