File tree Expand file tree Collapse file tree 3 files changed +35
-6
lines changed Expand file tree Collapse file tree 3 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ require (
1212 github.com/ashanbrown/makezero v0.0.0-20201205152432-7b7cdbb3025a
1313 github.com/bkielbasa/cyclop v1.2.0
1414 github.com/bombsimon/wsl/v3 v3.1.0
15- github.com/charithe/durationcheck v0.0.3
15+ github.com/charithe/durationcheck v0.0.4
1616 github.com/daixiang0/gci v0.2.8
1717 github.com/denis-tingajkin/go-header v0.4.2
1818 github.com/esimonov/ifshort v1.0.1
Original file line number Diff line number Diff line change 11//args: -Edurationcheck
22package testdata
33
4- import "time"
4+ import (
5+ "fmt"
6+ "time"
7+ )
58
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`"
837 time .Sleep (timeToWait )
938}
You can’t perform that action at this time.
0 commit comments