migrate from govendor to dep
This commit is contained in:
+9
-1
@@ -15,6 +15,7 @@ type Clock interface {
|
||||
After(d time.Duration) <-chan time.Time
|
||||
AfterFunc(d time.Duration, f func()) *Timer
|
||||
Now() time.Time
|
||||
Since(t time.Time) time.Duration
|
||||
Sleep(d time.Duration)
|
||||
Tick(d time.Duration) <-chan time.Time
|
||||
Ticker(d time.Duration) *Ticker
|
||||
@@ -37,6 +38,8 @@ func (c *clock) AfterFunc(d time.Duration, f func()) *Timer {
|
||||
|
||||
func (c *clock) Now() time.Time { return time.Now() }
|
||||
|
||||
func (c *clock) Since(t time.Time) time.Duration { return time.Since(t) }
|
||||
|
||||
func (c *clock) Sleep(d time.Duration) { time.Sleep(d) }
|
||||
|
||||
func (c *clock) Tick(d time.Duration) <-chan time.Time { return time.Tick(d) }
|
||||
@@ -87,7 +90,7 @@ func (m *Mock) Add(d time.Duration) {
|
||||
gosched()
|
||||
}
|
||||
|
||||
// Sets the current time of the mock clock to a specific one.
|
||||
// Set sets the current time of the mock clock to a specific one.
|
||||
// This should only be called from a single goroutine at a time.
|
||||
func (m *Mock) Set(t time.Time) {
|
||||
// Continue to execute timers until there are no more before the new time.
|
||||
@@ -158,6 +161,11 @@ func (m *Mock) Now() time.Time {
|
||||
return m.now
|
||||
}
|
||||
|
||||
// Since returns time since the mock clocks wall time.
|
||||
func (m *Mock) Since(t time.Time) time.Duration {
|
||||
return m.Now().Sub(t)
|
||||
}
|
||||
|
||||
// Sleep pauses the goroutine for the given duration on the mock clock.
|
||||
// The clock must be moved forward in a separate goroutine.
|
||||
func (m *Mock) Sleep(d time.Duration) {
|
||||
|
||||
Reference in New Issue
Block a user