MCPcopy Create free account
hub / github.com/bytebase/bytebase / main

Function main

action/main.go:16–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14)
15
16func main() {
17 slog.Info("bytebase-action version " + args.Version + " built at commit " + args.Gitcommit)
18 ctx, cancel := context.WithCancel(context.Background())
19 c := make(chan os.Signal, 1)
20 // Trigger graceful shutdown on SIGINT or SIGTERM.
21 // The default signal sent by the `kill` command is SIGTERM,
22 // which is taken as the graceful shutdown signal for many systems, eg., Kubernetes, Gunicorn.
23 signal.Notify(c, os.Interrupt, syscall.SIGTERM)
24 go func() {
25 sig := <-c
26 slog.Info(fmt.Sprintf("%s received.", sig.String()))
27 cancel()
28 }()
29
30 w := world.NewWorld()
31 cmd := command.NewRootCommand(w)
32
33 if err := cmd.ExecuteContext(ctx); err != nil {
34 slog.Error("failed to execute command", "error", fmt.Sprintf("%+v", err))
35 os.Exit(1)
36 }
37}

Callers

nothing calls this directly

Calls 6

NewWorldFunction · 0.92
NewRootCommandFunction · 0.92
cancelFunction · 0.85
InfoMethod · 0.80
StringMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected