Skip to content

Commit

Permalink
Parse flags that use "flag" package
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Rob Percival committed Nov 7, 2019
1 parent 06ebf30 commit c70fe60
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c70fe60

Please sign in to comment.