Command Line Argument Processing in Go

From NovaOrdis Knowledge Base
Revision as of 22:52, 2 October 2023 by Ovidiu (talk | contribs) (Created page with "=Internal= *Go Code Examples#Code_Examples =Overview= <font color=darkkhaki>Use the <code>flag</code> package: </font> <syntaxhighlight lang='go'> var port int flag.IntV...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Internal

Overview

Use the flag package:

var port int
flag.IntVar(&port, "port", 8080, "Some documentation for the flag")
flag.Parse()