Standard library / flag

flag.Int64()

Registers a flag on the default command line. Signed 64-bit integer, independent of native int width. Run with arguments: ["-x=4294967296"]. Expected stdout: '4294967296\n'.

Formal Syntax & Structure

go syntaxgo
func Int64(name string, value int64, usage string) *int64

Parameters & Attributes

NameTypeDescription
namestringName of the flag or flag set.
valueint64Default value for registration, or text to parse for Set.
usagestringHelp text describing the flag.

Return Value

*int64

Registers a flag on the default command line.

Working Example

Example Snippetgo
package main
import (  "flag"  "fmt")
func main() { v := flag.Int64("x", 3, "value"); flag.Parse(); fmt.Println(*v) }
Go Reference