Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress logging before flag.Parse from glog #2970

Merged
merged 4 commits into from Feb 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 6 additions & 7 deletions dgraph/cmd/root.go
Expand Up @@ -18,8 +18,6 @@ package cmd

import (
goflag "flag"
"fmt"
"os"
"strings"

"github.com/dgraph-io/dgraph/dgraph/cmd/alpha"
Expand Down Expand Up @@ -56,11 +54,12 @@ cluster.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
initCmds()
goflag.Parse()
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}

// Convinces goflags that Parse() has been called to avoid noisy logs.
// https://github.com/kubernetes/kubernetes/issues/17162#issuecomment-225596212
x.Check(goflag.CommandLine.Parse([]string{}))

x.Check(RootCmd.Execute())
}

var rootConf = viper.New()
Expand Down