Go解析命令行参数(简单版本)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Check Args
if len(os.Args) != 2 {
fmt.Println("Usage xxx <arg1> <arg2>")
return
}
arg1 := os.Args[1]
arg1 := os.Args[2]
// Check Args if len(os.Args) != 2 { fmt.Println("Usage xxx <arg1> <arg2>") return } arg1 := os.Args[1] arg1 := os.Args[2]
// Check Args
if len(os.Args) != 2 {
    fmt.Println("Usage xxx <arg1> <arg2>")
    return
}
 
arg1 := os.Args[1]
arg1 := os.Args[2]

 

Leave a Reply

Your email address will not be published. Required fields are marked *