Skip to content

Commit 53c9f33

Browse files
committed
Remove direct dependency on pflag
We weren't actually using pflag, except as an interface assertion. This makes it more obvious that pflag isn't actually used.
1 parent 48d7df3 commit 53c9f33

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ require (
1313
github.com/onsi/gomega v1.8.1
1414
github.com/prometheus/client_golang v1.0.0
1515
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
16-
github.com/spf13/pflag v1.0.5
1716
go.uber.org/zap v1.10.0
1817
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 // indirect
1918
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 // indirect

pkg/log/zap/flags.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ import (
2323
"strconv"
2424
"strings"
2525

26-
"github.com/spf13/pflag"
2726
"go.uber.org/zap"
2827
"go.uber.org/zap/zapcore"
2928
)
3029

30+
// each of these flags also should implement the flag.Value, as well
31+
// as pflag.Value for convinience.
32+
3133
var levelStrings = map[string]zapcore.Level{
3234
"debug": zap.DebugLevel,
3335
"-1": zap.DebugLevel,
@@ -46,8 +48,6 @@ type encoderFlag struct {
4648
value string
4749
}
4850

49-
var _ pflag.Value = &encoderFlag{}
50-
5151
func (ev *encoderFlag) String() string {
5252
return ev.value
5353
}
@@ -85,8 +85,6 @@ type levelFlag struct {
8585
value string
8686
}
8787

88-
var _ pflag.Value = &levelFlag{}
89-
9088
func (ev *levelFlag) Set(flagValue string) error {
9189
level, validLevel := levelStrings[strings.ToLower(flagValue)]
9290
if !validLevel {
@@ -119,8 +117,6 @@ type stackTraceFlag struct {
119117
value string
120118
}
121119

122-
var _ pflag.Value = &stackTraceFlag{}
123-
124120
func (ev *stackTraceFlag) Set(flagValue string) error {
125121
level, validLevel := levelStrings[strings.ToLower(flagValue)]
126122
if !validLevel {

0 commit comments

Comments
 (0)