diff --git a/README.md b/README.md index 8a49c3e..23779cb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,14 @@ -## Start up +## Hello, World 1. go build hello.go 2. ./hello + +## Args Sample + +```bash +$ ./args +args: [./args hoge fuga piyo] +args: [hoge fuga piyo] +args: hoge,fuga,piyo +$ +``` diff --git a/args.go b/args.go new file mode 100644 index 0000000..af4b3e9 --- /dev/null +++ b/args.go @@ -0,0 +1,15 @@ +package main + +import ( + "fmt" + "os" + "strings" +) + + +func main() { + fmt.Printf("args: %+v\n", os.Args) + fmt.Printf("args: %+v\n", os.Args[1:]) + fmt.Printf("args: %s\n", strings.Join(os.Args[1:], ",")) +} +