Skip to content

Commit

Permalink
CLUSTER-API-205: Initialize the 'flag' library to remove error messag…
Browse files Browse the repository at this point in the history
…e from glog (kubernetes-sigs#206)

Prior to this change, every line of logging had the following error message prefixing the actual log:

  ERROR: logging before flag.Parse

This is because glog has a hard dependency on the flag package. This 'hack' serves to make glog happy.
  • Loading branch information
spew authored and k8s-ci-robot committed May 25, 2018
1 parent d53f94f commit 8168f74
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cloud/google/cmd/gce-machine-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"k8s.io/apiserver/pkg/util/logs"
"sigs.k8s.io/cluster-api/cloud/google/cmd/gce-machine-controller/app"
"sigs.k8s.io/cluster-api/cloud/google/cmd/gce-machine-controller/app/options"
"flag"
)

func main() {
Expand All @@ -30,6 +31,8 @@ func main() {
s.AddFlags(pflag.CommandLine)

pflag.Parse()
// the following line exists to make glog happy, for more information, see: https://github.com/kubernetes/kubernetes/issues/17162
flag.CommandLine.Parse([]string{})

logs.InitLogs()
defer logs.FlushLogs()
Expand Down

0 comments on commit 8168f74

Please sign in to comment.