import ( "fmt" "flag" ) func main() { var in *string = flag.String("in", "infile", "input infile...") var out *string = flag.String("out", "outfile", "input outfile...") var op *string = flag.String("op", "op..", "ops...") // 命令行使用 xxx.exe -in thisisin -out thisisout -op thisisops flag.Parse() // 解析 if nil != in { fmt.Println("inFile : ", *in, " outFile : ", *out, " op : ", *op) } }
有疑问加站长微信联系(非本文作者)