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
+6.5k Golang : Handling image beyond OpenCV video capture boundary
+16.5k Golang : Execute terminal command to remote machine example
+18.4k Golang : Read binary file into memory
+7.9k Setting $GOPATH environment variable for Unix/Linux and Windows
+5.3k Javascript : Change page title to get viewer attention
+5.7k Fix yum-complete-transaction error
+7.5k Golang : Rename part of filename
+13.5k Golang : How to get year, month and day?
+11.5k Golang : Format numbers to nearest thousands such as kilos millions billions and trillions
+9.4k Golang : Launch Mac OS X Preview (or other OS) application from your program example
+41.4k Golang : Convert string to array/slice
+5.4k Golang : Reclaim memory occupied by make() example