go命令行参数例子:
package main
import(
"fmt"
"os"
"strings"
)
func main(){
who := "World!"
//有参数通过空格隔开
if len(os.Args) > 1 {
who = strings.Join(os.Args[1:], " ")
}
fmt.Println("Hello", who)
}
执行效果如下: