8000 chore: Use gofumpt instead of gofmt (#282) · obalunenko/advent-of-code@969c2ff · GitHub
[go: up one dir, main page]

Skip to content

Commit 969c2ff

Browse files
authored
chore: Use gofumpt instead of gofmt (#282)
* chore: Use gofumpt for format * chore: Run gofumpt
1 parent 9b4ebed commit 969c2ff

File tree

16 files changed

+37
-49
lines changed

16 files changed

+37
-49
lines changed

cmd/aoc-cli/handlers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func notFound(ctx context.Context) cli.CommandNotFoundFunc {
6868
}
6969
}
7070
}
71+
7172
func menu(ctx context.Context) cli.ActionFunc {
7273
return func(c *cli.Context) error {
7374
ctx = command.ContextWithOptions(ctx, optionsFromCli(c)...)

internal/command/command.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ import (
1313
"github.com/obalunenko/advent-of-code/internal/puzzles/input"
1414
)
1515

16-
var (
17-
// ErrUnauthorized returns when session is empty or invalid.
18-
ErrUnauthorized = errors.New("unauthorized")
19-
)
16+
// ErrUnauthorized returns when session is empty or invalid.
17+
var ErrUnauthorized = errors.New("unauthorized")
2018

2119
// Run runs puzzle solving for passed year/day date.
2220
func Run(ctx context.Context, year, day string) (puzzles.Result, error) {

internal/command/command_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func TestRun(t *testing.T) {
122122
wantErr assert.ErrorAssertionFunc
123123
}
124124

125-
var tests = []struct {
125+
tests := []struct {
126126
name string
127127
returnParams returnParams
128128
expected expected

internal/puzzles/common/intcomputer/intcoumputer_test.go

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,23 @@ func Test_New(t *testing.T) {
2525
args: args{
2626
input: strings.NewReader("1,9,10,3,2,3,11,0,99,30,40,50"),
2727
},
28-
want: IntComputer{memory: map[int]int{
29-
0: 1,
30-
1: 9,
31-
2: 10,
32-
3: 3,
33-
4: 2,
34-
5: 3,
35-
6: 11,
36-
7: 0,
37-
8: 99,
38-
9: 30,
39-
10: 40,
40-
11: 50,
28+
want: IntComputer{
29+
memory: map[int]int{
30+
0: 1,
31+
1: 9,
32+
2: 10,
33+
3: 3,
34+
4: 2,
35+
5: 3,
36+
6: 11,
37+
7: 0,
38+
8: 99,
39+
9: 30,
40+
10: 40,
41+
11: 50,
42+
},
43+
initial: []int{1, 9, 10, 3, 2, 3, 11, 0, 99, 30, 40, 50},
4144
},
42-
initial: []int{1, 9, 10, 3, 2, 3, 11, 0, 99, 30, 40, 50}},
4345
wantErr: false,
4446
},
4547
}

internal/puzzles/day_string_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
func TestDay_String(t *testing.T) {
1010
const dayNotExist Day = 99
1111

12-
var tests = []struct {
12+
tests := []struct {
1313
name string
1414
i Day
1515
want string

internal/puzzles/solutions/2015/day02/solution.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func (b box) surfaceWithExtra() int {
192192
}
193193

194194
func (b box) wrapRibbon() int {
195-
var sides = []int{
195+
sides := []int{
196196
b.height, b.width, b.length,
197197
}
198198

internal/puzzles/solutions/2017/day02/solution.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func (s solution) Part2(input io.Reader) (string, error) {
6868
for j := i + 1; j < len(numbers); j++ {
6969
d2 := numbers[j]
7070

71-
var a, b = d1, d2
71+
a, b := d1, d2
7272

7373
if a < b {
7474
a, b = b, a

internal/puzzles/solutions/2018/day01/solution.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ func (s solution) Part2(in io.Reader) (string, error) {
3535
return part2(in)
3636
}
3737

38-
var (
39-
re = regexp.MustCompile(`(?s)(?P<sign>[+-])(?P<digits>\d+)`)
40-
)
38+
var re = regexp.MustCompile(`(?s)(?P<sign>[+-])(?P<digits>\d+)`)
4139

4240
const (
4341
_ = iota

internal/puzzles/solutions/2018/day02/solution.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ func (s solution) Part1(input io.Reader) (string, error) {
3636
three = 3
3737
)
3838

39-
var (
40-
twoCount, threeCount int
41-
)
39+
var twoCount, threeCount int
4240

4341
for i := range boxes {
4442
box := boxes[i]
@@ -69,9 +67,7 @@ func (s solution) Part2(input io.Reader) (string, error) {
6967
// find common letters
7068
boxesnum := len(boxes)
7169

72-
var (
73-
box1, box2, common string
74-
)
70+
var box1, box2, common string
7571

7672
loop:
7773
for i := 0; i <= boxesnum; i++ {

internal/puzzles/solutions/2020/day01/solution.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func (s solution) Day() string {
2828
func (s solution) Part1(input io.Reader) (string, error) {
2929
scanner := bufio.NewScanner(input)
3030

31-
var expensereport = make(map[int]bool)
31+
expensereport := make(map[int]bool)
3232

3333
for scanner.Scan() {
3434
entry, err := strconv.Atoi(scanner.Text())
@@ -47,9 +47,7 @@ func (s solution) Part1(input io.Reader) (string, error) {
4747
dest = 2020
4848
)
4949

50-
var (
51-
a, b int
52-
)
50+
var a, b int
5351

5452
for e := range expensereport {
5553
a = e

0 commit comments

Comments
 (0)
0