Skip to content

Commit 446e005

Browse files
thaJeztahndeloof
authored andcommitted
format code with gofumpt
Format the code with gofumpt to prevent my IDE from reformatting every time I open a file. gofumpt provides a superset of gofmt, so should not impact users that are not using gofumpt. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent c01c9c2 commit 446e005

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+69
-93
lines changed

cmd/cmdtrace/cmd_span_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,4 @@ func TestGetFlags(t *testing.T) {
6060
}
6161
})
6262
}
63-
6463
}

cmd/compose/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ func runHash(ctx context.Context, dockerCli command.Cli, opts configOptions) err
348348
}
349349

350350
hash, err := compose.ServiceHash(s)
351-
352351
if err != nil {
353352
return err
354353
}

cmd/compose/create.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ func applyScaleOpts(project *types.Project, opts []string) error {
198198
}
199199

200200
func (opts createOptions) isPullPolicyValid() bool {
201-
pullPolicies := []string{types.PullPolicyAlways, types.PullPolicyNever, types.PullPolicyBuild,
202-
types.PullPolicyMissing, types.PullPolicyIfNotPresent}
201+
pullPolicies := []string{
202+
types.PullPolicyAlways, types.PullPolicyNever, types.PullPolicyBuild,
203+
types.PullPolicyMissing, types.PullPolicyIfNotPresent,
204+
}
203205
return slices.Contains(pullPolicies, opts.Pull)
204206
}

cmd/compose/scale.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ func parseServicesReplicasArgs(args []string) (map[string]int, error) {
9292
return nil, fmt.Errorf("invalid scale specifier: %s", arg)
9393
}
9494
intValue, err := strconv.Atoi(val)
95-
9695
if err != nil {
9796
return nil, fmt.Errorf("invalid scale specifier: can't parse replica value as int: %v", arg)
9897
}

cmd/compose/up_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,4 @@ func TestApplyScaleOpt(t *testing.T) {
4747
assert.NilError(t, err)
4848
assert.Equal(t, *bar.Scale, 3)
4949
assert.Equal(t, *bar.Deploy.Replicas, 3)
50-
5150
}

cmd/formatter/ansi.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,67 +27,78 @@ var disableAnsi bool
2727
func ansi(code string) string {
2828
return fmt.Sprintf("\033%s", code)
2929
}
30+
3031
func SaveCursor() {
3132
if disableAnsi {
3233
return
3334
}
3435
fmt.Print(ansi("7"))
3536
}
37+
3638
func RestoreCursor() {
3739
if disableAnsi {
3840
return
3941
}
4042
fmt.Print(ansi("8"))
4143
}
44+
4245
func HideCursor() {
4346
if disableAnsi {
4447
return
4548
}
4649
fmt.Print(ansi("[?25l"))
4750
}
51+
4852
func ShowCursor() {
4953
if disableAnsi {
5054
return
5155
}
5256
fmt.Print(ansi("[?25h"))
5357
}
58+
5459
func MoveCursor(y, x int) {
5560
if disableAnsi {
5661
return
5762
}
5863
fmt.Print(ansi(fmt.Sprintf("[%d;%dH", y, x)))
5964
}
65+
6066
func MoveCursorX(pos int) {
6167
if disableAnsi {
6268
return
6369
}
6470
fmt.Print(ansi(fmt.Sprintf("[%dG", pos)))
6571
}
72+
6673
func ClearLine() {
6774
if disableAnsi {
6875
return
6976
}
7077
// Does not move cursor from its current position
7178
fmt.Print(ansi("[2K"))
7279
}
80+
7381
func MoveCursorUp(lines int) {
7482
if disableAnsi {
7583
return
7684
}
7785
// Does not add new lines
7886
fmt.Print(ansi(fmt.Sprintf("[%dA", lines)))
7987
}
88+
8089
func MoveCursorDown(lines int) {
8190
if disableAnsi {
8291
return
8392
}
8493
// Does not add new lines
8594
fmt.Print(ansi(fmt.Sprintf("[%dB", lines)))
8695
}
96+
8797
func NewLine() {
8898
// Like \n
8999
fmt.Print("\012")
90100
}
101+
91102
func lenAnsi(s string) int {
92103
// len has into consideration ansi codes, if we want
93104
// the len of the actual len(string) we need to strip

cmd/formatter/colors.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ func makeColorFunc(code string) colorFunc {
104104
}
105105
}
106106

107-
var nextColor = rainbowColor
108-
var rainbow []colorFunc
109-
var currentIndex = 0
110-
var mutex sync.Mutex
107+
var (
108+
nextColor = rainbowColor
109+
rainbow []colorFunc
110+
currentIndex = 0
111+
mutex sync.Mutex
112+
)
111113

112114
func rainbowColor() colorFunc {
113115
mutex.Lock()

cmd/formatter/shortcut.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ type LogKeyboard struct {
110110
signalChannel chan<- os.Signal
111111
}
112112

113-
var KeyboardManager *LogKeyboard
114-
var eg multierror.Group
113+
var (
114+
KeyboardManager *LogKeyboard
115+
eg multierror.Group
116+
)
115117

116118
func NewKeyboardManager(ctx context.Context, isDockerDesktopActive, isWatchConfigured bool,
117119
sc chan<- os.Signal,
@@ -206,7 +208,7 @@ func (lk *LogKeyboard) navigationMenu() string {
206208
if openDDInfo != "" || openDDUI != "" {
207209
watchInfo = navColor(" ")
208210
}
209-
var isEnabled = " Enable"
211+
isEnabled := " Enable"
210212
if lk.Watch.Watching {
211213
isEnabled = " Disable"
212214
}
@@ -260,6 +262,7 @@ func (lk *LogKeyboard) openDDComposeUI(ctx context.Context, project *types.Proje
260262
}),
261263
)
262264
}
265+
263266
func (lk *LogKeyboard) openDDWatchDocs(ctx context.Context, project *types.Project) {
264267
eg.Go(tracing.EventWrapFuncForErrGroup(ctx, "menu/gui/watch", tracing.SpanOptions{},
265268
func(ctx context.Context) error {

internal/variables.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,5 @@
1616

1717
package internal
1818

19-
var (
20-
// Version is the version of the CLI injected in compilation time
21-
Version = "dev"
22-
)
19+
// Version is the version of the CLI injected in compilation time
20+
var Version = "dev"

pkg/api/api.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@ func (e Event) String() string {
431431
attr = append(attr, fmt.Sprintf("%s=%s", k, v))
432432
}
433433
return fmt.Sprintf("%s container %s %s (%s)\n", t, e.Status, e.Container, strings.Join(attr, ", "))
434-
435434
}
436435

437436
// ListOptions group options of the ls API

0 commit comments

Comments
 (0)