Skip to content

Commit be6bb8b

Browse files
committed
style: go fmt
1 parent dc0d8b3 commit be6bb8b

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

cmd/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func initGHSettings() (err error) {
2020
}
2121
}
2222

23-
if !githubAction() && prNumber == 0 {
23+
if !githubAction() && prNumber == 0 {
2424
return errMissingPRNum
2525
}
2626

cmd/utils_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func TestInitGitHubSettings(t *testing.T) {
1616
defer os.Unsetenv("GITHUB_TOKEN")
1717
_ = os.Setenv("GITHUB_REPOSITORY", "coolapso/convcommitlint")
1818
defer os.Unsetenv("GITHUB_REPOSITORY")
19-
defer func(){ repository = "" }()
19+
defer func() { repository = "" }()
2020
_ = os.Setenv("GITHUB_REF_NAME", "25/merge")
2121
defer os.Unsetenv("GITHUB_REF_NAME")
2222
}
@@ -47,15 +47,15 @@ func TestInitGitHubSettings(t *testing.T) {
4747
defer os.Unsetenv("GITHUB_REPOSITORY")
4848
_ = os.Setenv("GITHUB_REPOSITORY", "coolapso/convcommitlint")
4949
defer os.Unsetenv("GITHUB_TOKEN")
50-
defer func(){ repository = ""}()
50+
defer func() { repository = "" }()
5151
}
5252

5353
var eventTemp string
5454
if v, ok := os.LookupEnv("GITHUB_EVENT_NAME"); ok {
5555
eventTemp = v
5656
os.Setenv("GITHUB_EVENT_NAME", "push")
5757
defer os.Setenv("GITHUB_EVENT_NAME", eventTemp)
58-
} else {
58+
} else {
5959
os.Setenv("GITHUB_EVENT_NAME", "push")
6060
defer os.Setenv("GITHUB_EVENT_NAME", eventTemp)
6161
}
@@ -73,14 +73,13 @@ func TestInitGitHubSettings(t *testing.T) {
7373
}
7474
})
7575

76-
7776
t.Run("Run locally", func(t *testing.T) {
7877
if _, ok := os.LookupEnv("GITHUB_ACTIONS"); !ok {
7978
_ = os.Setenv("GITHUB_TOKEN", "foo")
8079
defer os.Unsetenv("GITHUB_TOKEN")
8180
_ = os.Setenv("GITHUB_REPOSITORY", "coolapso/convcommitlint")
8281
defer os.Unsetenv("GITHUB_REPOSITORY")
83-
func(){ repository = "" }()
82+
func() { repository = "" }()
8483
}
8584
prNumber = 25
8685
got := initGHSettings()
@@ -219,16 +218,16 @@ func TestPullRequest(t *testing.T) {
219218
if _, ok := os.LookupEnv("GITHUB_ACTIONS"); !ok {
220219
_ = os.Setenv("GITHUB_EVENT_NAME", "pull_request")
221220
defer os.Unsetenv("GITHUB_EVENT_NAME")
222-
}
221+
}
223222

224223
var eventTemp string
225224
if _, ok := os.LookupEnv("GITHUB_ACTIONS"); ok {
226225
if v := os.Getenv("GITHUB_EVENT_NAME"); v != "pull_request" {
227226
eventTemp = v
228227
os.Setenv("GITHUB_EVENT_NAME", "pull_request")
229-
defer func(){ os.Setenv("GITHUB_EVENT_NAME", eventTemp) }()
228+
defer func() { os.Setenv("GITHUB_EVENT_NAME", eventTemp) }()
230229
}
231-
}
230+
}
232231

233232
want := true
234233
got := pullRequest()

0 commit comments

Comments
 (0)