Skip to content

Commit 575a109

Browse files
authored
Merge pull request #40 from matsuri-tech/feat/gofumpt
feat: gofumpt -l -w .
2 parents 3c11bf2 + 07b9cfe commit 575a109

File tree

6 files changed

+21
-20
lines changed

6 files changed

+21
-20
lines changed

dateSpan.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package mdate
22

33
import (
4-
"github.com/matsuri-tech/common-error-go"
54
"sort"
5+
6+
"github.com/matsuri-tech/common-error-go"
67
)
78

89
type DateSpan struct {
@@ -49,9 +50,9 @@ func NoOverlapToClamp() merrors.CommonError {
4950
}
5051

5152
func (s DateSpan) GetDateList() Dates {
52-
var dateList = Dates{}
53+
dateList := Dates{}
5354
ey, em, ed := s.EndDate.Date()
54-
var currentDate = s.StartDate
55+
currentDate := s.StartDate
5556
for {
5657
y, m, d := currentDate.Date()
5758
dateList = append(dateList, currentDate)
@@ -95,7 +96,7 @@ func (s DateSpans) Less(i, j int) bool {
9596
// 重複除去してマージ
9697
func (s DateSpans) Merge() DateSpans {
9798
result := DateSpans{}
98-
//StartDate順にソート
99+
// StartDate順にソート
99100
sort.Sort(s)
100101
for i, span := range s {
101102
if i == 0 {
@@ -130,7 +131,7 @@ func (s DateSpansSlice) Merge() DateSpans {
130131

131132
func (s DateSpan) OverlappingYearMonth() YearMonths {
132133
var result YearMonths
133-
var currentYearMonth = NewYearMonth(s.StartDate.Year(), s.StartDate.Month())
134+
currentYearMonth := NewYearMonth(s.StartDate.Year(), s.StartDate.Month())
134135
for {
135136
if currentYearMonth.IsAfter(s.EndDate.YearMonth()) {
136137
break

dateSpan_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package mdate
22

33
import (
44
"fmt"
5-
merrors "github.com/matsuri-tech/common-error-go"
65
"reflect"
76
"testing"
7+
8+
merrors "github.com/matsuri-tech/common-error-go"
89
)
910

1011
func TestDateSpan_IsContinuous(t *testing.T) {
@@ -47,7 +48,6 @@ func TestDateSpan_IsContinuous(t *testing.T) {
4748
t.Error(i, tt)
4849
}
4950
}
50-
5151
}
5252

5353
func TestDateSpan_IsOverlapping(t *testing.T) {
@@ -99,7 +99,6 @@ func TestDateSpan_IsOverlapping(t *testing.T) {
9999
}
100100

101101
func TestDateSpan_IncludesDate(t *testing.T) {
102-
103102
span := MustDateSpan(NewDate(2018, 11, 12), NewDate(2018, 11, 15))
104103

105104
tests := []struct {
@@ -125,7 +124,6 @@ func TestDateSpan_IncludesDate(t *testing.T) {
125124
t.Error(i, tt)
126125
}
127126
}
128-
129127
}
130128

131129
func TestMerge(t *testing.T) {
@@ -163,7 +161,6 @@ func TestDateSpan_GetDateList(t *testing.T) {
163161
}
164162

165163
func TestDateSpan_OverlappingYearMonth(t *testing.T) {
166-
167164
type in struct {
168165
okimochi string
169166
span DateSpan

date_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ func TestDate_JapanFiscalYear(t *testing.T) {
194194
}
195195

196196
func TestDate_MarshalJSON(t *testing.T) {
197-
198197
type Sample struct {
199198
D Date `json:"d"`
200199
}

year.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package mdate
22

3-
//日本の年度を表すデータ型
3+
// 日本の年度を表すデータ型
44
type JapanFiscalYear int
55

66
type Year int

yearMonth.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package mdate
22

33
import (
44
"fmt"
5-
merrors "github.com/matsuri-tech/common-error-go"
65
"strconv"
76
"time"
7+
8+
merrors "github.com/matsuri-tech/common-error-go"
89
)
910

1011
type Month int

yearMonth_test.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package mdate
22

33
import (
4+
"testing"
5+
46
"github.com/matsuri-tech/common-error-go"
57
"github.com/stretchr/testify/assert"
6-
"testing"
78
)
89

910
func TestYearMonth_NextMonth(t *testing.T) {
10-
1111
tests := []struct {
1212
in YearMonth
1313
want YearMonth
@@ -111,7 +111,8 @@ func TestYearMonth_IsAfter(t *testing.T) {
111111
ym2: YearMonth{
112112
Year: 2020,
113113
Month: 2,
114-
}},
114+
},
115+
},
115116
want: false,
116117
},
117118
{
@@ -123,7 +124,8 @@ func TestYearMonth_IsAfter(t *testing.T) {
123124
ym2: YearMonth{
124125
Year: 2020,
125126
Month: 2,
126-
}},
127+
},
128+
},
127129
want: false,
128130
},
129131
{
@@ -135,7 +137,8 @@ func TestYearMonth_IsAfter(t *testing.T) {
135137
ym2: YearMonth{
136138
Year: 2019,
137139
Month: 2,
138-
}},
140+
},
141+
},
139142
want: true,
140143
},
141144
{
@@ -147,7 +150,8 @@ func TestYearMonth_IsAfter(t *testing.T) {
147150
ym2: YearMonth{
148151
Year: 2019,
149152
Month: 12,
150-
}},
153+
},
154+
},
151155
want: false,
152156
},
153157
}
@@ -247,7 +251,6 @@ func TestYearMonth_EndDate(t *testing.T) {
247251
}
248252

249253
func TestMonth_String(t *testing.T) {
250-
251254
tests := []struct {
252255
in YearMonth
253256
want string

0 commit comments

Comments
 (0)