Skip to content

Commit 0a6ebe9

Browse files
authored
Merge pull request #163 from antham/enable-gofumpt
Enable gofumpt, upgrade vendors
2 parents bb901ed + cf75dc7 commit 0a6ebe9

File tree

14 files changed

+48
-71
lines changed

14 files changed

+48
-71
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ permissions:
1414
jobs:
1515
call-workflow:
1616
uses: antham/go-workflow-github-action/.github/workflows/build.yml@master
17+
secrets:
18+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.golangci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
linters:
2+
enable:
3+
gofumpt

cmd/check.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ func parseDirectory(path string) (string, error) {
3333
}
3434
} else {
3535
f, err := os.Stat(path)
36-
3736
if err != nil {
3837
return "", fmt.Errorf(`Ensure "%s" directory exists`, path)
3938
}
@@ -57,7 +56,6 @@ func validateFileConfig() error {
5756

5857
for name, matcher := range viper.GetStringMapString("matchers") {
5958
_, err := regexp2.Compile(matcher, 0)
60-
6159
if err != nil {
6260
return fmt.Errorf(`Regexp "%s" identified by "%s" is not a valid regexp, please check the syntax`, matcher, name)
6361
}

cmd/check_commit.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@ var checkCommitCmd = &cobra.Command{
1616
Short: "Check commit message",
1717
Run: func(cmd *cobra.Command, args []string) {
1818
err := validateFileConfig()
19-
2019
if err != nil {
2120
failure(err)
2221

2322
exitError()
2423
}
2524

2625
ID, path, err := extractCheckCommitArgs(args)
27-
2826
if err != nil {
2927
failure(err)
3028

@@ -72,7 +70,6 @@ func extractCheckCommitArgs(args []string) (string, string, error) {
7270
}
7371

7472
path, err = parseDirectory(path)
75-
7673
if err != nil {
7774
return "", "", err
7875
}

cmd/check_commit_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ import (
1515

1616
func TestCheckCommitWithErrors(t *testing.T) {
1717
err := exec.Command("../features/repo.sh").Run()
18-
1918
if err != nil {
2019
logrus.Fatal(err)
2120
}
2221

2322
path, err := os.Getwd()
24-
2523
if err != nil {
2624
logrus.Fatal(err)
2725
}
@@ -148,14 +146,12 @@ func TestCheckCommitWithErrors(t *testing.T) {
148146

149147
func TestCheckCommit(t *testing.T) {
150148
path, err := os.Getwd()
151-
152149
if err != nil {
153150
logrus.Fatal(err)
154151
}
155152

156153
for _, filename := range []string{"../features/repo.sh"} {
157154
err = exec.Command(filename).Run()
158-
159155
if err != nil {
160156
logrus.Fatal(err)
161157
}
@@ -181,7 +177,6 @@ func TestCheckCommit(t *testing.T) {
181177
cmd.Dir = "testing-repository"
182178

183179
ID, err := cmd.Output()
184-
185180
if err != nil {
186181
logrus.Fatal(err)
187182
}
@@ -210,14 +205,12 @@ func TestCheckCommit(t *testing.T) {
210205

211206
func TestCheckCommitWithBadMessage(t *testing.T) {
212207
path, err := os.Getwd()
213-
214208
if err != nil {
215209
logrus.Fatal(err)
216210
}
217211

218212
for _, filename := range []string{"../features/repo.sh", "../features/bad-commit.sh"} {
219213
err = exec.Command(filename).Run()
220-
221214
if err != nil {
222215
logrus.Fatal(err)
223216
}
@@ -243,7 +236,6 @@ func TestCheckCommitWithBadMessage(t *testing.T) {
243236
cmd.Dir = "testing-repository"
244237

245238
ID, err := cmd.Output()
246-
247239
if err != nil {
248240
logrus.Fatal(err)
249241
}

cmd/check_message.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ var checkMessageCmd = &cobra.Command{
1515
Short: "Check message",
1616
Run: func(cmd *cobra.Command, args []string) {
1717
err := validateFileConfig()
18-
1918
if err != nil {
2019
failure(err)
2120

2221
exitError()
2322
}
2423

2524
message, err := extractCheckMessageArgs(args)
26-
2725
if err != nil {
2826
failure(err)
2927

cmd/check_message_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414

1515
func TestCheckMessageWithErrors(t *testing.T) {
1616
path, err := os.Getwd()
17-
1817
if err != nil {
1918
logrus.Fatal(err)
2019
}
@@ -97,15 +96,13 @@ func TestCheckMessageWithErrors(t *testing.T) {
9796

9897
func TestCheckMessage(t *testing.T) {
9998
path, err := os.Getwd()
100-
10199
if err != nil {
102100
logrus.Fatal(err)
103101
}
104102

105103
for _, filename := range []string{"../features/repo.sh"} {
106104

107105
err := exec.Command(filename).Run()
108-
109106
if err != nil {
110107
logrus.Fatal(err)
111108
}
@@ -151,15 +148,13 @@ func TestCheckMessage(t *testing.T) {
151148

152149
func TestCheckMessageWithBadMessage(t *testing.T) {
153150
path, err := os.Getwd()
154-
155151
if err != nil {
156152
logrus.Fatal(err)
157153
}
158154

159155
for _, filename := range []string{"../features/repo.sh"} {
160156

161157
err := exec.Command(filename).Run()
162-
163158
if err != nil {
164159
logrus.Fatal(err)
165160
}

cmd/check_range.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@ var checkRangeCmd = &cobra.Command{
1515
Short: "Check messages in range",
1616
Run: func(cmd *cobra.Command, args []string) {
1717
err := validateFileConfig()
18-
1918
if err != nil {
2019
failure(err)
2120

2221
exitError()
2322
}
2423

2524
from, to, path, err := extractCheckRangeArgs(args)
26-
2725
if err != nil {
2826
failure(err)
2927

@@ -47,7 +45,6 @@ var checkRangeCmd = &cobra.Command{
4745
func extractCheckRangeArgs(args []string) (string, string, string, error) {
4846
if len(args) < 2 {
4947
return "", "", "", fmt.Errorf("Two arguments required : origin commit and end commit")
50-
5148
}
5249

5350
if len(args) > 3 {
@@ -62,7 +59,6 @@ func extractCheckRangeArgs(args []string) (string, string, string, error) {
6259
}
6360

6461
path, err = parseDirectory(path)
65-
6662
if err != nil {
6763
return "", "", "", err
6864
}

cmd/check_range_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ import (
1515

1616
func TestCheckRangeWithErrors(t *testing.T) {
1717
err := exec.Command("../features/repo.sh").Run()
18-
1918
if err != nil {
2019
logrus.Fatal(err)
2120
}
2221

2322
path, err := os.Getwd()
24-
2523
if err != nil {
2624
logrus.Fatal(err)
2725
}
@@ -146,15 +144,13 @@ func TestCheckRangeWithErrors(t *testing.T) {
146144

147145
func TestCheckRangeWithBadCommitMessage(t *testing.T) {
148146
path, err := os.Getwd()
149-
150147
if err != nil {
151148
logrus.Fatal(err)
152149
}
153150

154151
for _, filename := range []string{"../features/repo.sh", "../features/bad-commit.sh"} {
155152

156153
err := exec.Command(filename).Run()
157-
158154
if err != nil {
159155
logrus.Fatal(err)
160156
}
@@ -206,15 +202,13 @@ func TestCheckRangeWithBadCommitMessage(t *testing.T) {
206202

207203
func TestCheckRangeWithNoErrors(t *testing.T) {
208204
path, err := os.Getwd()
209-
210205
if err != nil {
211206
logrus.Fatal(err)
212207
}
213208

214209
for _, filename := range []string{"../features/repo.sh"} {
215210

216211
err := exec.Command(filename).Run()
217-
218212
if err != nil {
219213
logrus.Fatal(err)
220214
}

go.mod

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
)
1313

1414
require (
15-
github.com/Microsoft/go-winio v0.5.2 // indirect
15+
github.com/Microsoft/go-winio v0.6.2 // indirect
1616
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
1717
github.com/emirpasic/gods v1.18.1 // indirect
1818
github.com/fsnotify/fsnotify v1.7.0 // indirect
@@ -25,28 +25,30 @@ require (
2525
github.com/mattn/go-isatty v0.0.20 // indirect
2626
github.com/mitchellh/go-homedir v1.1.0 // indirect
2727
github.com/mitchellh/mapstructure v1.5.0 // indirect
28-
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
28+
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
2929
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
3030
github.com/sagikazarmark/locafero v0.4.0 // indirect
3131
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
32-
github.com/sergi/go-diff v1.2.0 // indirect
32+
github.com/sergi/go-diff v1.3.1 // indirect
3333
github.com/sourcegraph/conc v0.3.0 // indirect
3434
github.com/spf13/afero v1.11.0 // indirect
3535
github.com/spf13/cast v1.6.0 // indirect
3636
github.com/spf13/pflag v1.0.5 // indirect
3737
github.com/src-d/gcfg v1.4.0 // indirect
3838
github.com/subosito/gotenv v1.6.0 // indirect
39-
github.com/xanzy/ssh-agent v0.3.1 // indirect
40-
go.uber.org/atomic v1.9.0 // indirect
41-
go.uber.org/multierr v1.9.0 // indirect
42-
golang.org/x/crypto v0.21.0 // indirect
43-
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
44-
golang.org/x/net v0.23.0 // indirect
45-
golang.org/x/sys v0.18.0 // indirect
39+
github.com/xanzy/ssh-agent v0.3.3 // indirect
40+
go.uber.org/atomic v1.11.0 // indirect
41+
go.uber.org/multierr v1.11.0 // indirect
42+
golang.org/x/crypto v0.22.0 // indirect
43+
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
44+
golang.org/x/net v0.24.0 // indirect
45+
golang.org/x/sys v0.19.0 // indirect
4646
gopkg.in/ini.v1 v1.67.0 // indirect
4747
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
4848
gopkg.in/warnings.v0 v0.1.2 // indirect
4949
gopkg.in/yaml.v3 v3.0.1 // indirect
5050
)
5151

52-
go 1.18
52+
go 1.21
53+
54+
toolchain go1.22.2

0 commit comments

Comments
 (0)