Skip to content

Commit

Permalink
Parse flags on startup.
Browse files Browse the repository at this point in the history
The generated code had imported flag but was not using it.

Not having flag.Parse() in the beginning was resulting in errors like the following when we hit a glog logged line.
ERROR: logging before flag.Parse: ...
  • Loading branch information
rohitagarwal003 committed Oct 30, 2018
1 parent f9b2fd8 commit 641bf03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/scaffold/manager/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import (
)
func main() {
flag.Parse()
logf.SetLogger(logf.ZapLogger(false))
log := logf.Log.WithName("entrypoint")
Expand Down
2 changes: 2 additions & 0 deletions test/project/cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package main

import (
"flag"
"os"

_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
Expand All @@ -30,6 +31,7 @@ import (
)

func main() {
flag.Parse()
logf.SetLogger(logf.ZapLogger(false))
log := logf.Log.WithName("entrypoint")

Expand Down

0 comments on commit 641bf03

Please sign in to comment.