Skip to content

Commit

Permalink
Merge pull request #9168 from cybozu-go/core-fix-unnecessary-option
Browse files Browse the repository at this point in the history
core: remove unnecessary option
  • Loading branch information
satoru-takeuchi committed Nov 15, 2021
2 parents 7d87de8 + 77e7c24 commit 07e1ca6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
6 changes: 5 additions & 1 deletion cmd/rook/ceph/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package ceph

import (
"flag"
"os"

"github.com/pkg/errors"
Expand All @@ -43,7 +44,10 @@ func init() {
operatorCmd.Flags().BoolVar(&operator.EnableMachineDisruptionBudget, "enable-machine-disruption-budget", false, "enable fencing controllers")

flags.SetFlagsFromEnv(operatorCmd.Flags(), rook.RookEnvVarPrefix)
flags.SetLoggingFlags(operatorCmd.Flags())
operatorCmd.Flags().AddGoFlagSet(flag.CommandLine)
if err := operatorCmd.Flags().Parse(nil); err != nil {
panic(err)
}
operatorCmd.RunE = startOperator
}

Expand Down
15 changes: 0 additions & 15 deletions pkg/util/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ limitations under the License.
package flags

import (
"flag"
"fmt"
"os"
"regexp"
Expand Down Expand Up @@ -55,20 +54,6 @@ func createRequiredFlagError(name string, flags []string) error {
return fmt.Errorf("%s are required for %s", strings.Join(flags, ","), name)
}

func SetLoggingFlags(flags *pflag.FlagSet) {
//Add commandline flags to the flagset. We will always write to stderr
//and not to a file by default
flags.AddGoFlagSet(flag.CommandLine)
if err := flags.Set("logtostderr", "true"); err != nil {
// TODO: fix me
// 2021-09-02 09:41:29.645366 I | op-flags: failed to set flag "logtostderr". no such flag -logtostderr
logger.Infof("failed to set flag %q. %v", "logtostderr", err)
}
if err := flags.Parse(nil); err != nil {
panic(err)
}
}

func SetFlagsFromEnv(flags *pflag.FlagSet, prefix string) {
var errorFlag bool
var err error
Expand Down

0 comments on commit 07e1ca6

Please sign in to comment.