Work around glog flag.Parse issue

Due to a change in glog, if you don't call flag.Parse, every log line
prints out 'ERROR: logging before flag.Parse'. This works around that
change. Ultimately we need to switch to a different logging library.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
This commit is contained in:
Andy Goldstein
2017-08-22 10:18:52 -04:00
parent 860eb7e845
commit b50a78cf7b

View File

@@ -31,7 +31,7 @@ import (
func NewCommand(name string) *cobra.Command {
c := &cobra.Command{
Use: name,
Use: name,
Short: "Back up and restore Kubernetes cluster resources.",
Long: `Heptio Ark is a tool for managing disaster recovery, specifically for
Kubernetes cluster resources. It provides a simple, configurable,
@@ -53,5 +53,10 @@ associated data.`,
// add the glog flags
c.PersistentFlags().AddGoFlagSet(flag.CommandLine)
// TODO: switch to a different logging library.
// Work around https://github.com/golang/glog/pull/13.
// See also https://github.com/kubernetes/kubernetes/issues/17162
flag.CommandLine.Parse([]string{})
return c
}