Skip to content

Commit f9e5cc2

Browse files
committed
format all codebase with gofumpt
1 parent 62db2d9 commit f9e5cc2

17 files changed

+49
-47
lines changed

args.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,11 @@ func (a *ArgumentBase[T, C, VC]) Parse(s []string) ([]string, error) {
143143
return s[count:], nil
144144
}
145145

146-
type FloatArg = ArgumentBase[float64, NoConfig, floatValue]
147-
type IntArg = ArgumentBase[int64, IntegerConfig, intValue]
148-
type StringArg = ArgumentBase[string, StringConfig, stringValue]
149-
type StringMapArg = ArgumentBase[map[string]string, StringConfig, StringMap]
150-
type TimestampArg = ArgumentBase[time.Time, TimestampConfig, timestampValue]
151-
type UintArg = ArgumentBase[uint64, IntegerConfig, uintValue]
146+
type (
147+
FloatArg = ArgumentBase[float64, NoConfig, floatValue]
148+
IntArg = ArgumentBase[int64, IntegerConfig, intValue]
149+
StringArg = ArgumentBase[string, StringConfig, stringValue]
150+
StringMapArg = ArgumentBase[map[string]string, StringConfig, StringMap]
151+
TimestampArg = ArgumentBase[time.Time, TimestampConfig, timestampValue]
152+
UintArg = ArgumentBase[uint64, IntegerConfig, uintValue]
153+
)

args_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
)
1111

1212
func TestArgumentsRootCommand(t *testing.T) {
13-
1413
cmd := buildMinimalTestCommand()
1514
var ival int64
1615
var fval float64
@@ -48,7 +47,6 @@ func TestArgumentsRootCommand(t *testing.T) {
4847
}
4948

5049
func TestArgumentsSubcommand(t *testing.T) {
51-
5250
cmd := buildMinimalTestCommand()
5351
var ifval int64
5452
var svals []string

cli.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ import (
2929
"strings"
3030
)
3131

32-
var (
33-
isTracingOn = os.Getenv("URFAVE_CLI_TRACING") == "on"
34-
)
32+
var isTracingOn = os.Getenv("URFAVE_CLI_TRACING") == "on"
3533

3634
func tracef(format string, a ...any) {
3735
if !isTracingOn {

command_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2867,7 +2867,8 @@ func TestPersistentFlag(t *testing.T) {
28672867
},
28682868
}
28692869

2870-
err := cmd.Run(buildTestContext(t), []string{"app",
2870+
err := cmd.Run(buildTestContext(t), []string{
2871+
"app",
28712872
"--persistentCommandFlag", "hello",
28722873
"--persistentCommandSliceFlag", "100",
28732874
"--persistentCommandOverrideFlag", "102",
@@ -2903,7 +2904,6 @@ func TestPersistentFlag(t *testing.T) {
29032904
}
29042905

29052906
func TestPersistentFlagIsSet(t *testing.T) {
2906-
29072907
result := ""
29082908
resultIsSet := false
29092909

@@ -2939,7 +2939,6 @@ func TestPersistentFlagIsSet(t *testing.T) {
29392939
}
29402940

29412941
func TestRequiredPersistentFlag(t *testing.T) {
2942-
29432942
app := &Command{
29442943
Name: "root",
29452944
Flags: []Flag{
@@ -3701,7 +3700,6 @@ func TestCommand_ParentCommand_Set(t *testing.T) {
37013700
}
37023701

37033702
func TestCommandReadArgsFromStdIn(t *testing.T) {
3704-
37053703
tests := []struct {
37063704
name string
37073705
input string
@@ -3860,7 +3858,6 @@ func TestCommandReadArgsFromStdIn(t *testing.T) {
38603858
} else {
38613859
r.Error(err)
38623860
}
3863-
38643861
})
38653862
}
38663863
}

errors.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ type mutuallyExclusiveGroupRequiredFlag struct {
8080
}
8181

8282
func (e *mutuallyExclusiveGroupRequiredFlag) Error() string {
83-
8483
var missingFlags []string
8584
for _, grpf := range e.flags.Flags {
8685
var grpString []string

fish.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ func (cmd *Command) prepareFishFlags(flags []Flag, previousCommands []string) []
133133
completion.WriteString(fmt.Sprintf(
134134
" -s %s", strings.TrimSpace(opt),
135135
))
136-
137136
}
138137
}
139138

flag_bool_with_inverse_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import (
99
"github.com/stretchr/testify/require"
1010
)
1111

12-
var (
13-
errBothEnvFlagsAreSet = fmt.Errorf("cannot set both flags `--env` and `--no-env`")
14-
)
12+
var errBothEnvFlagsAreSet = fmt.Errorf("cannot set both flags `--env` and `--no-env`")
1513

1614
type boolWithInverseTestCase struct {
1715
args []string
@@ -361,7 +359,6 @@ func TestBoolWithInverseDestination(t *testing.T) {
361359
checkAndReset := func(expectedCount int, expectedValue bool) error {
362360
if *count != expectedCount {
363361
return fmt.Errorf("expected count to be %d, got %d", expectedCount, *count)
364-
365362
}
366363

367364
if *destination != expectedValue {

flag_float_slice.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import (
44
"flag"
55
)
66

7-
type FloatSlice = SliceBase[float64, NoConfig, floatValue]
8-
type FloatSliceFlag = FlagBase[[]float64, NoConfig, FloatSlice]
7+
type (
8+
FloatSlice = SliceBase[float64, NoConfig, floatValue]
9+
FloatSliceFlag = FlagBase[[]float64, NoConfig, FloatSlice]
10+
)
911

1012
var NewFloatSlice = NewSliceBase[float64, NoConfig, floatValue]
1113

flag_int_slice.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package cli
22

3-
type IntSlice = SliceBase[int64, IntegerConfig, intValue]
4-
type IntSliceFlag = FlagBase[[]int64, IntegerConfig, IntSlice]
3+
type (
4+
IntSlice = SliceBase[int64, IntegerConfig, intValue]
5+
IntSliceFlag = FlagBase[[]int64, IntegerConfig, IntSlice]
6+
)
57

68
var NewIntSlice = NewSliceBase[int64, IntegerConfig, intValue]
79

flag_string_map.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package cli
22

3-
type StringMap = MapBase[string, StringConfig, stringValue]
4-
type StringMapFlag = FlagBase[map[string]string, StringConfig, StringMap]
3+
type (
4+
StringMap = MapBase[string, StringConfig, stringValue]
5+
StringMapFlag = FlagBase[map[string]string, StringConfig, StringMap]
6+
)
57

68
var NewStringMap = NewMapBase[string, StringConfig, stringValue]
79

flag_string_slice.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package cli
22

3-
type StringSlice = SliceBase[string, StringConfig, stringValue]
4-
type StringSliceFlag = FlagBase[[]string, StringConfig, StringSlice]
3+
type (
4+
StringSlice = SliceBase[string, StringConfig, stringValue]
5+
StringSliceFlag = FlagBase[[]string, StringConfig, StringSlice]
6+
)
57

68
var NewStringSlice = NewSliceBase[string, StringConfig, stringValue]
79

flag_uint_slice.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package cli
22

3-
type UintSlice = SliceBase[uint64, IntegerConfig, uintValue]
4-
type UintSliceFlag = FlagBase[[]uint64, IntegerConfig, UintSlice]
3+
type (
4+
UintSlice = SliceBase[uint64, IntegerConfig, uintValue]
5+
UintSliceFlag = FlagBase[[]uint64, IntegerConfig, UintSlice]
6+
)
57

68
var NewUintSlice = NewSliceBase[uint64, IntegerConfig, uintValue]
79

flag_validation_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
)
99

1010
func TestFlagDefaultValidation(t *testing.T) {
11-
1211
cmd := &Command{
1312
Name: "foo",
1413
Flags: []Flag{
@@ -33,7 +32,6 @@ func TestFlagDefaultValidation(t *testing.T) {
3332
}
3433

3534
func TestFlagValidation(t *testing.T) {
36-
3735
r := require.New(t)
3836

3937
testCases := []struct {

help_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,8 @@ func TestMutuallyExclusiveFlags(t *testing.T) {
11891189
Name: "s1",
11901190
},
11911191
},
1192-
}},
1192+
},
1193+
},
11931194
},
11941195
}
11951196

internal/build/build.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func testCleanup(packages []string) error {
289289
}
290290
}
291291

292-
return os.WriteFile("coverage.txt", out.Bytes(), 0644)
292+
return os.WriteFile("coverage.txt", out.Bytes(), 0o644)
293293
}
294294

295295
func GfmrunActionFunc(ctx context.Context, cmd *cli.Command) error {
@@ -499,7 +499,7 @@ func GenerateActionFunc(ctx context.Context, cmd *cli.Command) error {
499499
return os.WriteFile(
500500
filepath.Join(top, "godoc-current.txt"),
501501
[]byte(cliDocs),
502-
0644,
502+
0o644,
503503
)
504504
}
505505

@@ -557,7 +557,7 @@ func EnsureGfmrunActionFunc(ctx context.Context, cmd *cli.Command) error {
557557
return err
558558
}
559559

560-
return downloadFile(gfmrunURL.String(), gfmrunExe, 0755, 0755)
560+
return downloadFile(gfmrunURL.String(), gfmrunExe, 0o755, 0o755)
561561
}
562562

563563
func EnsureMkdocsActionFunc(ctx context.Context, cmd *cli.Command) error {
@@ -642,7 +642,6 @@ func V3Diff(ctx context.Context, cmd *cli.Command) error {
642642
"--label=b/godoc",
643643
"godoc-current.txt",
644644
)
645-
646645
if err != nil {
647646
fmt.Printf("# %v ---> Hey! <---\n", badNewsEmoji)
648647
fmt.Println(strings.TrimSpace(v3diffWarning))

template.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
package cli
22

3-
var helpNameTemplate = `{{$v := offset .FullName 6}}{{wrap .FullName 3}}{{if .Usage}} - {{wrap .Usage $v}}{{end}}`
4-
var argsTemplate = `{{if .Arguments}}{{range .Arguments}}{{.Usage}}{{end}}{{end}}`
5-
var usageTemplate = `{{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.FullName}}{{if .VisibleFlags}} [command [command options]]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}{{template "argsTemplate" .}}{{end}}{{end}}`
6-
var descriptionTemplate = `{{wrap .Description 3}}`
7-
var authorsTemplate = `{{with $length := len .Authors}}{{if ne 1 $length}}S{{end}}{{end}}:
3+
var (
4+
helpNameTemplate = `{{$v := offset .FullName 6}}{{wrap .FullName 3}}{{if .Usage}} - {{wrap .Usage $v}}{{end}}`
5+
argsTemplate = `{{if .Arguments}}{{range .Arguments}}{{.Usage}}{{end}}{{end}}`
6+
usageTemplate = `{{if .UsageText}}{{wrap .UsageText 3}}{{else}}{{.FullName}}{{if .VisibleFlags}} [command [command options]]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}{{template "argsTemplate" .}}{{end}}{{end}}`
7+
descriptionTemplate = `{{wrap .Description 3}}`
8+
authorsTemplate = `{{with $length := len .Authors}}{{if ne 1 $length}}S{{end}}{{end}}:
89
{{range $index, $author := .Authors}}{{if $index}}
910
{{end}}{{$author}}{{end}}`
11+
)
12+
1013
var visibleCommandTemplate = `{{ $cv := offsetCommands .VisibleCommands 5}}{{range .VisibleCommands}}
1114
{{$s := join .Names ", "}}{{$s}}{{ $sp := subtract $cv (offset $s 3) }}{{ indent $sp ""}}{{wrap .Usage $cv}}{{end}}`
15+
1216
var visibleCommandCategoryTemplate = `{{range .VisibleCategories}}{{if .Name}}
1317
1418
{{.Name}}:{{range .VisibleCommands}}
1519
{{join .Names ", "}}{{"\t"}}{{.Usage}}{{end}}{{else}}{{template "visibleCommandTemplate" .}}{{end}}{{end}}`
20+
1621
var visibleFlagCategoryTemplate = `{{range .VisibleFlagCategories}}
1722
{{if .Name}}{{.Name}}
1823

value_source_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ func TestEnvVarValueSource(t *testing.T) {
3333
r.True(ok)
3434
r.Equal(str, "bar")
3535
})
36-
3736
})
3837

3938
t.Run("implements fmt.Stringer", func(t *testing.T) {
@@ -80,7 +79,7 @@ func TestFileValueSource(t *testing.T) {
8079
fileName := filepath.Join(os.TempDir(), fmt.Sprintf("urfave-cli-testing-existing_file-%[1]v", rand.Int()))
8180
t.Cleanup(func() { _ = os.Remove(fileName) })
8281

83-
r.Nil(os.WriteFile(fileName, []byte("pita"), 0644))
82+
r.Nil(os.WriteFile(fileName, []byte("pita"), 0o644))
8483

8584
t.Run("found", func(t *testing.T) {
8685
src := &fileValueSource{Path: fileName}
@@ -113,7 +112,7 @@ func TestFilePaths(t *testing.T) {
113112
fileName := filepath.Join(os.TempDir(), fmt.Sprintf("urfave-cli-tests-some_file_name_%[1]v", rand.Int()))
114113
t.Cleanup(func() { _ = os.Remove(fileName) })
115114

116-
r.Nil(os.WriteFile(fileName, []byte("Hello"), 0644))
115+
r.Nil(os.WriteFile(fileName, []byte("Hello"), 0o644))
117116

118117
sources := Files("junk_file_name", fileName)
119118
str, src, ok := sources.LookupWithSource()

0 commit comments

Comments
 (0)