Standard library / flag
flag.FlagSet.Int64()
Registers a flag on an independent FlagSet. Signed 64-bit integer, independent of native int width. Run with arguments: ["-x=4294967296"]. Expected stdout: '4294967296\n'.
Formal Syntax & Structure
go syntaxgo
func (f *FlagSet) Int64(name string, value int64, usage string) *int64Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Name of the flag or flag set. |
| value | int64 | Default value for registration, or text to parse for Set. |
| usage | string | Help text describing the flag. |
Return Value
*int64
Registers a flag on an independent FlagSet.
Working Example
Example Snippetgo
package main
import ( "flag" "fmt" "os")
func check(e error) { if e != nil { panic(e) }}
func main() { f := flag.NewFlagSet("demo", flag.ContinueOnError) v := f.Int64("x", 3, "value") check(f.Parse(os.Args[1:])) fmt.Println(*v)}