Skip to content

Commit

Permalink
Merge pull request #796 from traPtitech/fix-golangci-lint
Browse files Browse the repository at this point in the history
golangci-lintまわりの修正
  • Loading branch information
H1rono authored Sep 1, 2024
2 parents c2239b2 + e947aef commit cd89f3f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
name: Go
on: push

on:
push:
branches:
- v2
pull_request:
branches:
- v2
workflow_dispatch:
schedule:
- cron: "0 0 1 * *"

jobs:

Expand Down
4 changes: 2 additions & 2 deletions service/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func WebhookEventHandler(c echo.Context, reqBody, resBody []byte) {
message += fmt.Sprintf("- 請求先グループ: %s\n", resApp.Group.Name)
}

if resApp.Tags != nil && len(resApp.Tags) != 0 {
if len(resApp.Tags) != 0 {
tags := lo.Map(resApp.Tags, func(tag *Tag, index int) string {
return tag.Name
})
Expand Down Expand Up @@ -188,7 +188,7 @@ func WebhookEventHandler(c echo.Context, reqBody, resBody []byte) {
if resApp.Group != nil {
message += fmt.Sprintf("- 関連するグループ: %s\n", resApp.Group.Name)
}
if resApp.Tags != nil && len(resApp.Tags) != 0 {
if len(resApp.Tags) != 0 {
tags := lo.Map(resApp.Tags, func(tag *Tag, index int) string {
return tag.Name
})
Expand Down
20 changes: 10 additions & 10 deletions testutil/random/ramdom.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,39 @@ func AlphaNumeric(t *testing.T, n int) string {
return string(b)
}

func Numeric(t *testing.T, max int) int {
func Numeric(t *testing.T, n int) int {
t.Helper()
return rand.IntN(max)
return rand.IntN(n)
}

func Numeric64(t *testing.T, max int64) int64 {
func Numeric64(t *testing.T, n int64) int64 {
t.Helper()
return rand.Int64N(max)
return rand.Int64N(n)
}

func AlphaNumericSlice(t *testing.T, length int, max int64) []string {
func AlphaNumericSlice(t *testing.T, length int, n int64) []string {
t.Helper()
slice := []string{}
for range length {
slice = append(slice, AlphaNumeric(t, int(max)))
slice = append(slice, AlphaNumeric(t, int(n)))
}
return slice
}

func NumericSlice(t *testing.T, length int, max int) []int {
func NumericSlice(t *testing.T, length int, n int) []int {
t.Helper()
slice := []int{}
for range length {
slice = append(slice, Numeric(t, max))
slice = append(slice, Numeric(t, n))
}
return slice
}

func Numeric64Slice(t *testing.T, length int, max int64) []int64 {
func Numeric64Slice(t *testing.T, length int, n int64) []int64 {
t.Helper()
slice := []int64{}
for range length {
slice = append(slice, Numeric64(t, max))
slice = append(slice, Numeric64(t, n))
}
return slice
}

0 comments on commit cd89f3f

Please sign in to comment.