LoginSignup
28
22

More than 5 years have passed since last update.

Go言語でOS種類を判定する

Posted at

runtime.GOOS"darwin", "windows", "linux", "freebsd" などが取得出来ます。

runtime - The Go Programming Language

package main

import (
    "fmt"
    "runtime"
)

func main() {
    command := "milk"

    if runtime.GOOS == "windows" {
        command = "milk.bat"
    }
28
22
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
22