package main import ( "context" "fmt" "os" "os/signal" "syscall" "time" ) func runMain(ctx context.Context, arguments []string) error { if len(arguments) == 2 && arguments[0] == "wait-oidc" { return waitForOIDC(ctx, arguments[1], 2*time.Second) } value, err := parseOptions(arguments) if err != nil { return err } return runController(ctx, value) } func main() { ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) err := runMain(ctx, os.Args[1:]) stop() if err != nil { fmt.Fprintln(os.Stderr, "controller stopped:", err) os.Exit(1) } }