Minor fixes (#396)
* Add missing word * Rename `boolPtr` to `forkPtr` This is in order to be consistent with the other flags `wordPtr` & `numbPtr` which are based on the name of the flag and not the type of the flag.
This commit is contained in:
parent
eac6776159
commit
15c92ee528
@ -14,5 +14,5 @@ Thanks for your interest in contributing to Go by Example!
|
|||||||
first_.
|
first_.
|
||||||
|
|
||||||
* We're not going to change the navigation of the site, in particular adding
|
* We're not going to change the navigation of the site, in particular adding
|
||||||
a "previous section" link or an "index" link other than the on the title
|
a "previous section" link or an "index" link other than the one on the title
|
||||||
text.
|
text.
|
||||||
|
@ -26,7 +26,7 @@ func main() {
|
|||||||
// This declares `numb` and `fork` flags, using a
|
// This declares `numb` and `fork` flags, using a
|
||||||
// similar approach to the `word` flag.
|
// similar approach to the `word` flag.
|
||||||
numbPtr := flag.Int("numb", 42, "an int")
|
numbPtr := flag.Int("numb", 42, "an int")
|
||||||
boolPtr := flag.Bool("fork", false, "a bool")
|
forkPtr := flag.Bool("fork", false, "a bool")
|
||||||
|
|
||||||
// It's also possible to declare an option that uses an
|
// It's also possible to declare an option that uses an
|
||||||
// existing var declared elsewhere in the program.
|
// existing var declared elsewhere in the program.
|
||||||
@ -45,7 +45,7 @@ func main() {
|
|||||||
// to get the actual option values.
|
// to get the actual option values.
|
||||||
fmt.Println("word:", *wordPtr)
|
fmt.Println("word:", *wordPtr)
|
||||||
fmt.Println("numb:", *numbPtr)
|
fmt.Println("numb:", *numbPtr)
|
||||||
fmt.Println("fork:", *boolPtr)
|
fmt.Println("fork:", *forkPtr)
|
||||||
fmt.Println("svar:", svar)
|
fmt.Println("svar:", svar)
|
||||||
fmt.Println("tail:", flag.Args())
|
fmt.Println("tail:", flag.Args())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user