Golang flag.Arg() function examples
package flag
Arg returns the i'th command-line argument. Arg(0) is the first remaining argument after flags have been processed.
Golang flag.Arg() function usage examples
Example 1:
flag.Parse()
dbconnection, err := ConnectToDB(flag.Arg(0))
Example 2:
socketconnection := flag.Agr(1)
portnumber := flag.Arg(2)
Reference :
Advertisement
Something interesting
Tutorials
+17.7k Golang : Read data from config file and assign to variables
+8.2k How to show different content from website server when AdBlock is detected?
+8k Findstr command the Grep equivalent for Windows
+9.5k Golang : Accessing content anonymously with Tor
+6.9k Nginx : Password protect a directory/folder
+7.8k Golang : Reverse a string with unicode
+14k Golang: Pad right or print ending(suffix) zero or spaces in fmt.Printf example
+17.1k Golang : Capture stdout of a child process and act according to the result
+6.7k Golang : Reverse by word
+20.7k Golang : Read directory content with os.Open
+9.2k Golang : How to check if a string with spaces in between is numeric?
+27.4k Golang : Convert CSV data to JSON format and save to file