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
+18k Golang : How to log each HTTP request to your web server?
+36.3k Golang : How to split or chunking a file to smaller pieces?
+9.8k Golang : Qt get screen resolution and display on center example
+15k Golang : package is not in GOROOT during compilation
+17.4k Golang : Multi threading or run two processes or more example
+9.1k Golang : Serving HTTP and Websocket from different ports in a program example
+12.2k Golang : calculate elapsed run time
+41.4k Golang : Convert string to array/slice
+7.4k Golang : Word limiter example
+12.7k Golang : Send data to /dev/null a.k.a blackhole with ioutil.Discard
+31.7k Golang : How to convert(cast) string to IP address?
+25.7k Golang : How to write CSV data to file