]> Cypherpunks repositories - gostls13.git/commitdiff
time: no need to wrap error with errors.New
authorfangguizhen <1297394526@qq.com>
Mon, 16 Jan 2023 17:46:20 +0000 (17:46 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 20 Jan 2023 01:07:08 +0000 (01:07 +0000)
Change-Id: Ibd519ed6419f8f21c89a111a0326d0788aca9d19
GitHub-Last-Rev: 45e3224f9afef57f49eebf3cbdf6b1d01cfd7346
GitHub-Pull-Request: golang/go#57819
Reviewed-on: https://go-review.googlesource.com/c/go/+/462046
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

src/time/tick.go

index dcfeca8783cb28307a2951d331b0dad41720382f..9da16b5d5830d77591e25c720256cec181044de3 100644 (file)
@@ -4,8 +4,6 @@
 
 package time
 
-import "errors"
-
 // A Ticker holds a channel that delivers “ticks” of a clock
 // at intervals.
 type Ticker struct {
@@ -21,7 +19,7 @@ type Ticker struct {
 // panic. Stop the ticker to release associated resources.
 func NewTicker(d Duration) *Ticker {
        if d <= 0 {
-               panic(errors.New("non-positive interval for NewTicker"))
+               panic("non-positive interval for NewTicker")
        }
        // Give the channel a 1-element time buffer.
        // If the client falls behind while reading, we drop ticks