File tree 3 files changed +35
-6
lines changed
3 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ require (
12
12
github.com/ashanbrown/makezero v0.0.0-20201205152432-7b7cdbb3025a
13
13
github.com/bkielbasa/cyclop v1.2.0
14
14
github.com/bombsimon/wsl/v3 v3.1.0
15
- github.com/charithe/durationcheck v0.0.3
15
+ github.com/charithe/durationcheck v0.0.4
16
16
github.com/daixiang0/gci v0.2.8
17
17
github.com/denis-tingajkin/go-header v0.4.2
18
18
github.com/esimonov/ifshort v1.0.1
Original file line number Diff line number Diff line change 1
1
//args: -Edurationcheck
2
2
package testdata
3
3
4
- import "time"
4
+ import (
5
+ "fmt"
6
+ "time"
7
+ )
5
8
6
- func waitFor (someDuration time.Duration ) {
7
- timeToWait := someDuration * time .Second // ERROR "Multiplication of durations: `someDuration \\* time.Second` "
9
+ type durationCheckData struct {
10
+ i int
11
+ d time.Duration
12
+ }
13
+
14
+ func durationcheckCase01 () {
15
+ dcd := durationCheckData {i : 10 }
16
+ _ = time .Duration (dcd .i ) * time .Second
17
+ }
18
+
19
+ func durationcheckCase02 () {
20
+ dcd := durationCheckData {d : 10 * time .Second }
21
+ _ = dcd .d * time .Second // ERROR "Multiplication of durations: `dcd.d \\* time.Second`"
22
+ }
23
+
24
+ func durationcheckCase03 () {
25
+ seconds := 10
26
+ fmt .Print (time .Duration (seconds ) * time .Second )
27
+ }
28
+
29
+ func durationcheckCase04 (someDuration time.Duration ) {
30
+ timeToWait := someDuration * time .Second // ERROR "Multiplication of durations: `someDuration \\* time.Second`"
31
+ time .Sleep (timeToWait )
32
+ }
33
+
34
+ func durationcheckCase05 () {
35
+ someDuration := 2 * time .Second
36
+ timeToWait := someDuration * time .Second // ERROR "Multiplication of durations: `someDuration \\* time.Second`"
8
37
time .Sleep (timeToWait )
9
38
}
You can’t perform that action at this time.
0 commit comments