INNER CODE UNIT · Go
main
sensu/sensu-go · cmd/sensu-agent/main.go:16
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// Define our root command and add our commands
rootCmd := &cobra.Command{
Use: "sensu-agent",
Short: "sensu agent",
}
// Watch for the shutdown signals
agent.GracefulShutdown(cancel)
rootCmd.AddCommand(cmd.VersionCommand())
startCmd, err := cmd.StartCommandWithErrorAndContext(agent.NewAgentContext, ctx)
if err != nil {
logger.WithError(err).Fatal("error handling agent config")
}