Golang flag.Set() function examples

package flag

Set sets the value of the named command-line flag.

Golang flag.Set() function usage examples

Example 1:

 flag.Set("log_chunk_size", "3")

Example 2:

 err := flag.Set("errorhttp.log", "false")
 if err != nil {
 fmt.Println("Error setting errorhttp.log: %s", err)
 os.Exit(1)
 }

Reference :

http://golang.org/pkg/flag/#Set

Advertisement