Skip to content

Commit 641bf03

Browse files
Parse flags on startup.
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: ...
1 parent f9b2fd8 commit 641bf03

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

pkg/scaffold/manager/cmd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import (
5757
)
5858
5959
func main() {
60+
flag.Parse()
6061
logf.SetLogger(logf.ZapLogger(false))
6162
log := logf.Log.WithName("entrypoint")
6263

test/project/cmd/manager/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package main
1818

1919
import (
20+
"flag"
2021
"os"
2122

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

3233
func main() {
34+
flag.Parse()
3335
logf.SetLogger(logf.ZapLogger(false))
3436
log := logf.Log.WithName("entrypoint")
3537

0 commit comments

Comments
 (0)