Skip to content

Commit

Permalink
Merge pull request #18956 from mmorel-35/gofumpt/pkg
Browse files Browse the repository at this point in the history
fix: enable gofumpt instead of gofmt linter globally
  • Loading branch information
ahrtr authored Nov 30, 2024
2 parents 46127e7 + f75f402 commit e476f72
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
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
2 changes: 1 addition & 1 deletion tools/.golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ linters:
# - structcheck
# - varcheck
- errorlint
- gofmt
- gofumpt
- goimports
- ineffassign
- nakedret
Expand Down

0 comments on commit e476f72

Please sign in to comment.