2022-04-25 17:13:12 +01:00
|
|
|
package utils
|
|
|
|
|
2024-05-10 02:12:15 +01:00
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"runtime"
|
|
|
|
)
|
2022-04-25 17:13:12 +01:00
|
|
|
|
|
|
|
// GetGo returns the go executable to use depending on what
|
|
|
|
// is set in the XCADDY_WHICH_GO environment variable.
|
|
|
|
func GetGo() string {
|
|
|
|
g := os.Getenv("XCADDY_WHICH_GO")
|
|
|
|
if g == "" {
|
|
|
|
return "go"
|
|
|
|
}
|
|
|
|
return g
|
|
|
|
}
|
2024-05-10 02:12:15 +01:00
|
|
|
|
|
|
|
// GetGOOS returns the compilation target OS
|
|
|
|
func GetGOOS() string {
|
|
|
|
o := os.Getenv("GOOS")
|
|
|
|
if o == "" {
|
|
|
|
return runtime.GOOS
|
|
|
|
}
|
|
|
|
return o
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetGOARCH returns the compilation target architecture
|
|
|
|
func GetGOARCH() string {
|
|
|
|
a := os.Getenv("GOARCH")
|
|
|
|
if a == "" {
|
|
|
|
return runtime.GOARCH
|
|
|
|
}
|
|
|
|
return a
|
|
|
|
}
|