GitBucket
4.23.0
Toggle navigation
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
sample-golang
/
01_hello
Browse code
add args sample
master
1 parent
8961c63
commit
2922a5bc82d50e56d3084b171176f77f780b74c0
yhornisse
authored
on 20 Sep 2021
Patch
Showing
2 changed files
README.md
args.go
Ignore Space
Show notes
View
README.md
## 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 $ ```
## Start up 1. go build hello.go 2. ./hello
Ignore Space
Show notes
View
args.go
0 → 100644
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:], ",")) }
Show line notes below