diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-05-04 15:01:11 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-05-04 15:01:11 +0000 |
commit | 33e337e34d69a2e298be8b6c109b601c2986339b (patch) | |
tree | df1037674f2c69011469485414315a50607f9d08 /libgo/go/flag | |
parent | 1eae36f08cddc7779cd0ed75b359c9a54f67adff (diff) | |
download | gcc-33e337e34d69a2e298be8b6c109b601c2986339b.zip gcc-33e337e34d69a2e298be8b6c109b601c2986339b.tar.gz gcc-33e337e34d69a2e298be8b6c109b601c2986339b.tar.bz2 |
libgo: Update to Go 1.0.1 release.
From-SVN: r187163
Diffstat (limited to 'libgo/go/flag')
-rw-r--r-- | libgo/go/flag/flag.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libgo/go/flag/flag.go b/libgo/go/flag/flag.go index c28d0e7..f0842a1 100644 --- a/libgo/go/flag/flag.go +++ b/libgo/go/flag/flag.go @@ -7,9 +7,11 @@ Usage: - Define flags using flag.String(), Bool(), Int(), etc. Example: + Define flags using flag.String(), Bool(), Int(), etc. + + This declares an integer flag, -flagname, stored in the pointer ip, with type *int. import "flag" - var ip *int = flag.Int("flagname", 1234, "help message for flagname") + var ip = flag.Int("flagname", 1234, "help message for flagname") If you like, you can bind the flag to a variable using the Var() functions. var flagvar int func init() { @@ -26,8 +28,8 @@ Flags may then be used directly. If you're using the flags themselves, they are all pointers; if you bind to variables, they're values. - fmt.Println("ip has value ", *ip); - fmt.Println("flagvar has value ", flagvar); + fmt.Println("ip has value ", *ip) + fmt.Println("flagvar has value ", flagvar) After parsing, the arguments after the flag are available as the slice flag.Args() or individually as flag.Arg(i). |