Use more idiomatic <int> * <const> for intervals
This commit is contained in:
@@ -15,7 +15,7 @@ func main() {
|
||||
// after 2s.
|
||||
c1 := make(chan string, 1)
|
||||
go func() {
|
||||
time.Sleep(time.Second * 2)
|
||||
time.Sleep(2 * time.Second)
|
||||
c1 <- "result 1"
|
||||
}()
|
||||
|
||||
@@ -28,7 +28,7 @@ func main() {
|
||||
select {
|
||||
case res := <-c1:
|
||||
fmt.Println(res)
|
||||
case <-time.After(time.Second * 1):
|
||||
case <-time.After(1 * time.Second):
|
||||
fmt.Println("timeout 1")
|
||||
}
|
||||
|
||||
@@ -36,13 +36,13 @@ func main() {
|
||||
// from `c2` will succeed and we'll print the result.
|
||||
c2 := make(chan string, 1)
|
||||
go func() {
|
||||
time.Sleep(time.Second * 2)
|
||||
time.Sleep(2 * time.Second)
|
||||
c2 <- "result 2"
|
||||
}()
|
||||
select {
|
||||
case res := <-c2:
|
||||
fmt.Println(res)
|
||||
case <-time.After(time.Second * 3):
|
||||
case <-time.After(3 * time.Second):
|
||||
fmt.Println("timeout 2")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
5ea69771a4d4c6286fd587f91e03cd386f77cada
|
||||
NR2GHXUKeM
|
||||
93343e1aacb14f818c87732914c29ba57afab245
|
||||
MgcfA-xpJO9
|
||||
|
||||
Reference in New Issue
Block a user