1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/internal/buildtarget/buildtarget.go
Andy Grunwald 825f19bb55 fix: Typo in buildtarget
The buildtarget contained a typo. This fixes it.
2018-01-20 18:30:33 +01:00

39 lines
808 B
Go

package buildtarget
import (
"fmt"
"runtime"
)
// Runtime is the current runtime build target
var Runtime = Target{runtime.GOOS, runtime.GOARCH, ""}
// New build Target
func New(goos, goarch, goarm string) Target {
return Target{goos, goarch, goarm}
}
// Target is a build target
type Target struct {
OS, Arch, Arm string
}
// Env returns the current Target as environment variables
func (t Target) Env() []string {
return []string{
"GOOS=" + t.OS,
"GOARCH=" + t.Arch,
"GOARM=" + t.Arm,
}
}
func (t Target) String() string {
// TODO: maybe replace this as suggested to OS_ArchArm?
return fmt.Sprintf("%v%v%v", t.OS, t.Arch, t.Arm)
}
// PrettyString is a prettier version of the String method.
func (t Target) PrettyString() string {
return fmt.Sprintf("%v/%v%v", t.OS, t.Arch, t.Arm)
}