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

fix: enable gofumpt instead of gofmt linter in pkg #18956

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pkg/expect/expect.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ import (

const debugLinesTail = 40

var (
ErrProcessRunning = fmt.Errorf("process is still running")
)
var ErrProcessRunning = fmt.Errorf("process is still running")

type ExpectedResponse struct {
Value string
Expand Down
6 changes: 3 additions & 3 deletions pkg/featuregate/feature_gate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func TestFeatureGateOverride(t *testing.T) {
const testBetaGate Feature = "TestBeta"

// Don't parse the flag, assert defaults are used.
var f = New("test", zaptest.NewLogger(t))
f := New("test", zaptest.NewLogger(t))
f.Add(map[Feature]FeatureSpec{
testAlphaGate: {Default: false, PreRelease: Alpha},
testBetaGate: {Default: false, PreRelease: Beta},
Expand Down Expand Up @@ -262,7 +262,7 @@ func TestFeatureGateFlagDefaults(t *testing.T) {
const testBetaGate Feature = "TestBeta"

// Don't parse the flag, assert defaults are used.
var f = New("test", zaptest.NewLogger(t))
f := New("test", zaptest.NewLogger(t))
f.Add(map[Feature]FeatureSpec{
testAlphaGate: {Default: false, PreRelease: Alpha},
testBetaGate: {Default: true, PreRelease: Beta},
Expand All @@ -286,7 +286,7 @@ func TestFeatureGateKnownFeatures(t *testing.T) {
)

// Don't parse the flag, assert defaults are used.
var f = New("test", zaptest.NewLogger(t))
f := New("test", zaptest.NewLogger(t))
f.Add(map[Feature]FeatureSpec{
testAlphaGate: {Default: false, PreRelease: Alpha},
testBetaGate: {Default: true, PreRelease: Beta},
Expand Down
1 change: 1 addition & 0 deletions pkg/netutil/netutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ func TestURLsEqual(t *testing.T) {
}
}
}

func TestURLStringsEqual(t *testing.T) {
defer func() { resolveTCPAddr = resolveTCPAddrDefault }()
errOnResolve := func(ctx context.Context, addr string) (*net.TCPAddr, error) {
Expand Down
8 changes: 5 additions & 3 deletions pkg/netutil/routes_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ import (
"go.etcd.io/etcd/pkg/v3/cpuutil"
)

var errNoDefaultRoute = fmt.Errorf("could not find default route")
var errNoDefaultHost = fmt.Errorf("could not find default host")
var errNoDefaultInterface = fmt.Errorf("could not find default interface")
var (
errNoDefaultRoute = fmt.Errorf("could not find default route")
errNoDefaultHost = fmt.Errorf("could not find default host")
errNoDefaultInterface = fmt.Errorf("could not find default interface")
)

// GetDefaultHost obtains the first IP address of machine from the routing table and returns the IP address as string.
// An IPv4 address is preferred to an IPv6 address for backward compatibility.
Expand Down
6 changes: 2 additions & 4 deletions pkg/osutil/osutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@
// Package osutil implements operating system-related utility functions.
package osutil

var (
// support to override setting SIG_DFL so tests don't terminate early
setDflSignal = dflSignal
)
// support to override setting SIG_DFL so tests don't terminate early
var setDflSignal = dflSignal
6 changes: 4 additions & 2 deletions pkg/traceutil/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,14 @@ func (t *Trace) logInfo(threshold time.Duration) (string, []zap.Field) {
lastStepTime = tstep.time
}

fs := []zap.Field{zap.String("detail", writeFields(t.fields)),
fs := []zap.Field{
zap.String("detail", writeFields(t.fields)),
zap.Duration("duration", totalDuration),
zap.Time("start", t.startTime),
zap.Time("end", endTime),
zap.Strings("steps", steps),
zap.Int("step_count", len(steps))}
zap.Int("step_count", len(steps)),
}
return msg, fs
}

Expand Down