INNER CODE UNIT · Go

run

spegel-org/spegel · main.go:103

func run(args *Arguments) error {
	ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
	defer cancel()

	opts := slog.HandlerOptions{
		AddSource: true,
		Level:     args.LogLevel,
	}
	handler := slog.NewJSONHandler(os.Stderr, &opts)
	log := logr.FromSlogHandler(handler)
	ctx = logr.NewContext(ctx, log)

	err := func() error {
		switch {
		case args.Version != nil:
			return versionCommand(ctx, args.Version)
		case args.Configuration != nil:
			return configurationCommand(ctx, args.Configuration)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…