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
+7.5k Golang : Create zip/ePub file without compression(use Store algorithm)
+7.9k Setting $GOPATH environment variable for Unix/Linux and Windows
+21.4k Curl usage examples with Golang
+30k Golang : How to declare kilobyte, megabyte, gigabyte, terabyte and so on?
+14.2k Golang : Chunk split or divide a string into smaller chunk example
+5.2k Golang : Calculate half life decay example
+5.2k Golang : Convert lines of string into list for delete and insert operation
+8.3k Golang : Number guessing game with user input verification example
+9.2k Golang : does not implement flag.Value (missing Set method)
+21.2k Golang : How to get time zone and load different time zone?