Skip to content

Commit fa411db

Browse files
committed
Using go 1.20 and improving README.md
1 parent 54f9ea9 commit fa411db

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ t2 _________|
2424
tp ____|‾‾‾‾|___
2525
```
2626

27-
It also provides a function `Overlaps` to check whether the two time periods overlaps, and what's the overlapping period
27+
If start time or end time are zero, it means no limit.
28+
29+
The struct also provides a function `Overlaps` to check whether two time periods overlaps, and what is the overlapping period
2830

2931
e.g.
3032

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module GoTime
22

3-
go 1.22
3+
go 1.20

pkg/timeperiod/timeperiods_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func TestTimePeriod_GetDuration(t *testing.T) {
4242
},
4343
}
4444
for name, test := range tests {
45+
name, test := name, test
4546
t.Run(name, func(t *testing.T) {
4647
t.Parallel()
4748
actual := test.timePeriod.GetDuration()
@@ -305,6 +306,7 @@ func TestTimePeriod_DoesIntersect(t *testing.T) {
305306
}
306307

307308
for name, test := range tests {
309+
name, test := name, test
308310
t.Run(name, func(t *testing.T) {
309311
t.Parallel()
310312
actualResult := test.basePeriod.doesIntersect(test.comparePeriod)
@@ -633,6 +635,7 @@ func TestTimePeriod_Intersect(t *testing.T) {
633635
}
634636

635637
for name, test := range tests {
638+
name, test := name, test
636639
t.Run(name, func(t *testing.T) {
637640
t.Parallel()
638641
actualResult := test.basePeriod.intersect(test.comparePeriod)
@@ -682,10 +685,10 @@ func TestTimePeriod_NewTimePeriod(t *testing.T) {
682685
},
683686
}
684687
for name, test := range tests {
688+
name, test := name, test
685689
t.Run(name, func(t *testing.T) {
686690
t.Parallel()
687691
_, err := NewTimePeriod(test.startTime, test.endTime)
688-
689692
if !errors.Is(test.expectedErr, err) {
690693
t.Errorf("Expected: %v, Actual: %v", test.expectedErr, err)
691694
}

0 commit comments

Comments
 (0)