Use tabs as the canonical source indentation in git
Space conversion is done during generation only. Fixes #192
This commit is contained in:
committed by
Mark McGranaghan
parent
1699ad1c45
commit
7c160440be
@@ -13,37 +13,37 @@ import "fmt"
|
||||
|
||||
func main() {
|
||||
|
||||
// Basic flag declarations are available for string,
|
||||
// integer, and boolean options. Here we declare a
|
||||
// string flag `word` with a default value `"foo"`
|
||||
// and a short description. This `flag.String` function
|
||||
// returns a string pointer (not a string value);
|
||||
// we'll see how to use this pointer below.
|
||||
wordPtr := flag.String("word", "foo", "a string")
|
||||
// Basic flag declarations are available for string,
|
||||
// integer, and boolean options. Here we declare a
|
||||
// string flag `word` with a default value `"foo"`
|
||||
// and a short description. This `flag.String` function
|
||||
// returns a string pointer (not a string value);
|
||||
// we'll see how to use this pointer below.
|
||||
wordPtr := flag.String("word", "foo", "a string")
|
||||
|
||||
// This declares `numb` and `fork` flags, using a
|
||||
// similar approach to the `word` flag.
|
||||
numbPtr := flag.Int("numb", 42, "an int")
|
||||
boolPtr := flag.Bool("fork", false, "a bool")
|
||||
// This declares `numb` and `fork` flags, using a
|
||||
// similar approach to the `word` flag.
|
||||
numbPtr := flag.Int("numb", 42, "an int")
|
||||
boolPtr := flag.Bool("fork", false, "a bool")
|
||||
|
||||
// It's also possible to declare an option that uses an
|
||||
// existing var declared elsewhere in the program.
|
||||
// Note that we need to pass in a pointer to the flag
|
||||
// declaration function.
|
||||
var svar string
|
||||
flag.StringVar(&svar, "svar", "bar", "a string var")
|
||||
// It's also possible to declare an option that uses an
|
||||
// existing var declared elsewhere in the program.
|
||||
// Note that we need to pass in a pointer to the flag
|
||||
// declaration function.
|
||||
var svar string
|
||||
flag.StringVar(&svar, "svar", "bar", "a string var")
|
||||
|
||||
// Once all flags are declared, call `flag.Parse()`
|
||||
// to execute the command-line parsing.
|
||||
flag.Parse()
|
||||
// Once all flags are declared, call `flag.Parse()`
|
||||
// to execute the command-line parsing.
|
||||
flag.Parse()
|
||||
|
||||
// Here we'll just dump out the parsed options and
|
||||
// any trailing positional arguments. Note that we
|
||||
// need to dereference the pointers with e.g. `*wordPtr`
|
||||
// to get the actual option values.
|
||||
fmt.Println("word:", *wordPtr)
|
||||
fmt.Println("numb:", *numbPtr)
|
||||
fmt.Println("fork:", *boolPtr)
|
||||
fmt.Println("svar:", svar)
|
||||
fmt.Println("tail:", flag.Args())
|
||||
// Here we'll just dump out the parsed options and
|
||||
// any trailing positional arguments. Note that we
|
||||
// need to dereference the pointers with e.g. `*wordPtr`
|
||||
// to get the actual option values.
|
||||
fmt.Println("word:", *wordPtr)
|
||||
fmt.Println("numb:", *numbPtr)
|
||||
fmt.Println("fork:", *boolPtr)
|
||||
fmt.Println("svar:", svar)
|
||||
fmt.Println("tail:", flag.Args())
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
e2ba0461c090789168c712cc7ed0f66aab09a8c8
|
||||
NASEOq2R3n
|
||||
klFR5DitrCy
|
||||
|
||||
Reference in New Issue
Block a user