Use more idiomatic <int> * <const> for intervals

This commit is contained in:
Mark McGranaghan
2018-02-09 14:14:25 -08:00
parent 1d272218fd
commit 01a5f6de68
15 changed files with 37 additions and 37 deletions

View File

@@ -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")
}
}

View File

@@ -1,2 +1,2 @@
5ea69771a4d4c6286fd587f91e03cd386f77cada
NR2GHXUKeM
93343e1aacb14f818c87732914c29ba57afab245
MgcfA-xpJO9