Golang 获取当前系统架构和操作系统
package main import ( "fmt" "runtime" ) func main() { fmt.Println(runtime.GOOS) fmt.Println(runtime.GOARCH) }
结果:
#go run go-cpu.go
linux
amd64
package main import ( "fmt" "runtime" ) func main() { fmt.Println(runtime.GOOS) fmt.Println(runtime.GOARCH) }
结果:
#go run go-cpu.go
linux
amd64