From 08c86b40108179e6676deb2b4c54717cd0735278 Mon Sep 17 00:00:00 2001 From: josedonizetti Date: Sat, 27 Jul 2019 11:05:49 -0300 Subject: [PATCH] Add comment explaining pkg/initflag --- cmd/minikube/main.go | 2 ++ pkg/initflag/initflag.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/minikube/main.go b/cmd/minikube/main.go index 57f6df5c24..fef04d79b5 100644 --- a/cmd/minikube/main.go +++ b/cmd/minikube/main.go @@ -23,6 +23,8 @@ import ( "os" "strconv" + // initflag must be imported before any other minikube pkg. + // Fix for https://github.com/kubernetes/minikube/issues/4866 _ "k8s.io/minikube/pkg/initflag" "github.com/golang/glog" diff --git a/pkg/initflag/initflag.go b/pkg/initflag/initflag.go index 7fccc59ebf..806b8ba76b 100644 --- a/pkg/initflag/initflag.go +++ b/pkg/initflag/initflag.go @@ -21,8 +21,9 @@ import ( ) func init() { + // Workaround for "ERROR: logging before flag.Parse" + // See: https://github.com/kubernetes/kubernetes/issues/17162 fs := flag.NewFlagSet("", flag.ContinueOnError) - _ = fs.Parse([]string{}) flag.CommandLine = fs }