github.com/nibnait/go-learn@v0.0.0-20220227013611-dfa47ea6d2da/src/main/chapter/hello_world.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "os" 6 ) 7 8 // go run hello_world.go tian bin 9 func main() { 10 fmt.Println(os.Args[0]) 11 fmt.Println(os.Args[1]) 12 //fmt.Println(os.Args[2]) 13 14 if len(os.Args) > 1 { 15 fmt.Println("hello world", os.Args[1]) 16 } 17 18 fmt.Println("hello world") 19 os.Exit(0) 20 }