mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 02:16:48 +08:00
update book code
This commit is contained in:
16
eBook/examples/chapter_12/os_args.go
Normal file
16
eBook/examples/chapter_12/os_args.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// os_args.go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
who := "Alice "
|
||||
if len(os.Args) > 1 {
|
||||
who += strings.Join(os.Args[1:], " ")
|
||||
}
|
||||
fmt.Println("Good Morning", who)
|
||||
}
|
Reference in New Issue
Block a user