From 3ae4e65d3bb8e3b72c039a512825e796cbadd896 Mon Sep 17 00:00:00 2001 From: Patrick Zheng Date: Fri, 14 Mar 2025 13:05:19 +0800 Subject: [PATCH] fix main Signed-off-by: Patrick Zheng --- cmd/notation/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/notation/main.go b/cmd/notation/main.go index ccd085113..b88661a02 100644 --- a/cmd/notation/main.go +++ b/cmd/notation/main.go @@ -27,7 +27,7 @@ import ( "github.com/spf13/cobra" ) -func main() { +func run() error { cmd := &cobra.Command{ Use: "notation", Short: "Notation - a tool to sign and verify artifacts", @@ -71,7 +71,11 @@ func main() { ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) defer cancel() - if err := cmd.ExecuteContext(ctx); err != nil { + return cmd.ExecuteContext(ctx) +} + +func main() { + if err := run(); err != nil { os.Exit(1) } }