Golang OS 확인

1 개요[ | ]

Go OS 확인
Golang OS 확인
Go
CPU
-1.0s
MEM
-0M
-1.0s
Copy
package main

import (
	"fmt"
	"runtime"
)

func main() {
	os := runtime.GOOS
	switch os {
	case "windows":
		fmt.Println("Windows")
	case "darwin":
		fmt.Println("MacOS")
	case "linux":
		fmt.Println("Linux")
	default:
		fmt.Printf("%s.\n", os)
	}
}
Linux

2 같이 보기[ | ]

3 참고[ | ]