package main import ( "fmt" "github.com/codegangsta/cli" ) func main() { app := cli.NewApp() app.Flags = []cli.Flag{ cli.StringFlag{ Name: "config, c", Usage: "Load configuration from `FILE`", }, } app.Action = func(c *cli.Context) { if c.IsSet("config") { fmt.Printf("Using config file: %s\n", c.String("config")) } else { fmt.Println("No config file specified.") } } app.Run([]string{"myapp", "--config", "myconfig.yaml"}) }In this example, we define a command-line application with a "config" flag using the "cli.StringFlag" struct. In the "app.Action" function, we check if the "config" flag is set using "c.IsSet" method. If it is set, we print the name of the configuration file, else we print a message that no file was specified. The "Context IsSet" method is helpful in situations where we need to check if a specific flag or argument is present in the context and perform a task accordingly. It is a part of the "github.com/codegangsta/cli" package library.