From fb0a3a55b771ae4a2f00a367a0083f466a395e0a Mon Sep 17 00:00:00 2001 From: Ville Vesilehto Date: Fri, 11 Oct 2024 23:49:22 +0300 Subject: [PATCH] fix: errcheck for parsing CLI flags --- cmd/vault-plugin-auth-gcp/main.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cmd/vault-plugin-auth-gcp/main.go b/cmd/vault-plugin-auth-gcp/main.go index 754fb26..9dd124e 100644 --- a/cmd/vault-plugin-auth-gcp/main.go +++ b/cmd/vault-plugin-auth-gcp/main.go @@ -15,7 +15,10 @@ import ( func main() { apiClientMeta := &api.PluginAPIClientMeta{} flags := apiClientMeta.FlagSet() - flags.Parse(os.Args[1:]) + + if err := flags.Parse(os.Args[1:]); err != nil { + fatal(err) + } tlsConfig := apiClientMeta.GetTLSConfig() tlsProviderFunc := api.VaultPluginTLSProvider(tlsConfig) @@ -27,7 +30,11 @@ func main() { TLSProviderFunc: tlsProviderFunc, }) if err != nil { - log.Println(err) - os.Exit(1) + fatal(err) } } + +func fatal(err error) { + log.Println(err) + os.Exit(1) +}