From c70fe6063b7321a16d20d9c0961b0bd4cd2797bc Mon Sep 17 00:00:00 2001 From: Rob Percival Date: Wed, 5 Jun 2019 17:24:39 +0100 Subject: [PATCH] Parse flags that use "flag" package It appears that Cobra will not automatically parse these flags, as it does with those declared via its own API. This avoids warnings from the glog package about logging before flag parsing. --- main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/main.go b/main.go index f24e4df..a6a353e 100644 --- a/main.go +++ b/main.go @@ -46,6 +46,7 @@ func init() { } func main() { + flag.Parse() rootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine) if err := parseGoBuildFlags(rootCmd.PersistentFlags()); err != nil { glog.Error(err)