Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

golangci-lintまわりの修正 #796

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
message += fmt.Sprintf("- 請求先グループ: %s\n", resApp.Group.Name)
}

if resApp.Tags != nil && len(resApp.Tags) != 0 {
if len(resApp.Tags) != 0 {

Check warning on line 130 in service/webhook.go

View check run for this annotation

Codecov / codecov/patch

service/webhook.go#L130

Added line #L130 was not covered by tests
tags := lo.Map(resApp.Tags, func(tag *Tag, index int) string {
return tag.Name
})
Expand Down Expand Up @@ -188,7 +188,7 @@
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 {

Check warning on line 191 in service/webhook.go

View check run for this annotation

Codecov / codecov/patch

service/webhook.go#L191

Added line #L191 was not covered by tests
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 @@
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 {

Check warning on line 28 in testutil/random/ramdom.go

View check run for this annotation

Codecov / codecov/patch

testutil/random/ramdom.go#L28

Added line #L28 was not covered by tests
t.Helper()
return rand.Int64N(max)
return rand.Int64N(n)

Check warning on line 30 in testutil/random/ramdom.go

View check run for this annotation

Codecov / codecov/patch

testutil/random/ramdom.go#L30

Added line #L30 was not covered by tests
}

func AlphaNumericSlice(t *testing.T, length int, max int64) []string {
func AlphaNumericSlice(t *testing.T, length int, n int64) []string {

Check warning on line 33 in testutil/random/ramdom.go

View check run for this annotation

Codecov / codecov/patch

testutil/random/ramdom.go#L33

Added line #L33 was not covered by tests
t.Helper()
slice := []string{}
for range length {
slice = append(slice, AlphaNumeric(t, int(max)))
slice = append(slice, AlphaNumeric(t, int(n)))

Check warning on line 37 in testutil/random/ramdom.go

View check run for this annotation

Codecov / codecov/patch

testutil/random/ramdom.go#L37

Added line #L37 was not covered by tests
}
return slice
}

func NumericSlice(t *testing.T, length int, max int) []int {
func NumericSlice(t *testing.T, length int, n int) []int {

Check warning on line 42 in testutil/random/ramdom.go

View check run for this annotation

Codecov / codecov/patch

testutil/random/ramdom.go#L42

Added line #L42 was not covered by tests
t.Helper()
slice := []int{}
for range length {
slice = append(slice, Numeric(t, max))
slice = append(slice, Numeric(t, n))

Check warning on line 46 in testutil/random/ramdom.go

View check run for this annotation

Codecov / codecov/patch

testutil/random/ramdom.go#L46

Added line #L46 was not covered by tests
}
return slice
}

func Numeric64Slice(t *testing.T, length int, max int64) []int64 {
func Numeric64Slice(t *testing.T, length int, n int64) []int64 {

Check warning on line 51 in testutil/random/ramdom.go

View check run for this annotation

Codecov / codecov/patch

testutil/random/ramdom.go#L51

Added line #L51 was not covered by tests
t.Helper()
slice := []int64{}
for range length {
slice = append(slice, Numeric64(t, max))
slice = append(slice, Numeric64(t, n))

Check warning on line 55 in testutil/random/ramdom.go

View check run for this annotation

Codecov / codecov/patch

testutil/random/ramdom.go#L55

Added line #L55 was not covered by tests
}
return slice
}