mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-08 16:06:47 +00:00
* Set image suffix for OpenFaaS Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
30 lines
560 B
Go
30 lines
560 B
Go
package env
|
|
|
|
import (
|
|
"log"
|
|
"strings"
|
|
|
|
execute "github.com/alexellis/go-execute/pkg/v1"
|
|
)
|
|
|
|
// GetClientArch returns a pair of arch and os
|
|
func GetClientArch() (string, string) {
|
|
task := execute.ExecTask{Command: "uname", Args: []string{"-m"}}
|
|
res, err := task.Execute()
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
|
|
arch := strings.TrimSpace(res.Stdout)
|
|
|
|
taskOS := execute.ExecTask{Command: "uname", Args: []string{"-s"}}
|
|
resOS, errOS := taskOS.Execute()
|
|
if errOS != nil {
|
|
log.Println(errOS)
|
|
}
|
|
|
|
os := strings.TrimSpace(resOS.Stdout)
|
|
|
|
return arch, os
|
|
}
|