import ( "flag" "fmt" ) func main() { fs := flag.NewFlagSet("example", flag.ExitOnError) // defining a boolean flag with a shorthand abbreviation var verbose bool fs.BoolVar(&verbose, "verbose", false, "enable verbose logging") fs.BoolVar(&verbose, "v", false, "shorthand for verbose") // defining a string flag var configFile string fs.StringVar(&configFile, "config", "config.yaml", "path to configuration file") // defining an integer flag var limit int fs.IntVar(&limit, "limit", 10, "maximum number of records to retrieve") // parse the command-line arguments fs.Parse(os.Args[1:]) // access the flag values fmt.Println("Verbose logging enabled:", verbose) fmt.Println("Using configuration file:", configFile) fmt.Println("Limiting records to:", limit) }In this example, a FlagSet is created called "example" with an exit code of 1 if an error occurs during parsing. Three flags are defined using the Set method: a boolean flag with a default value of false and shorthand abbreviation of -v, a string flag with a default value of "config.yaml", and an integer flag with a default value of 10. The Parse method is then called to parse the command-line arguments provided to the program. Finally, the values of each flag are printed to the console. This code example demonstrates the use of the "flag" package and its FlagSet and Set methods to create and parse command-line arguments for a Go program.