mirror of
https://github.com/coredns/coredns.git
synced 2025-10-31 18:23:13 -04:00
Dep helper (#2151)
* Add dep task to update go dependencies * Update go dependencies
This commit is contained in:
committed by
Miek Gieben
parent
8f8b81f56b
commit
0e8977761d
18
vendor/github.com/modern-go/concurrent/map_test.go
generated
vendored
18
vendor/github.com/modern-go/concurrent/map_test.go
generated
vendored
@@ -1,18 +0,0 @@
|
||||
package concurrent_test
|
||||
|
||||
import (
|
||||
"github.com/modern-go/concurrent"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMap_Load(t *testing.T) {
|
||||
m := concurrent.NewMap()
|
||||
m.Store("hello", "world")
|
||||
value, found := m.Load("hello")
|
||||
if !found {
|
||||
t.Fail()
|
||||
}
|
||||
if value != "world" {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
54
vendor/github.com/modern-go/concurrent/unbounded_executor_test.go
generated
vendored
54
vendor/github.com/modern-go/concurrent/unbounded_executor_test.go
generated
vendored
@@ -1,54 +0,0 @@
|
||||
package concurrent_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
"github.com/modern-go/concurrent"
|
||||
)
|
||||
|
||||
func ExampleUnboundedExecutor_Go() {
|
||||
executor := concurrent.NewUnboundedExecutor()
|
||||
executor.Go(func(ctx context.Context) {
|
||||
fmt.Println("abc")
|
||||
})
|
||||
time.Sleep(time.Second)
|
||||
// output: abc
|
||||
}
|
||||
|
||||
func ExampleUnboundedExecutor_StopAndWaitForever() {
|
||||
executor := concurrent.NewUnboundedExecutor()
|
||||
executor.Go(func(ctx context.Context) {
|
||||
everyMillisecond := time.NewTicker(time.Millisecond)
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
fmt.Println("goroutine exited")
|
||||
return
|
||||
case <-everyMillisecond.C:
|
||||
// do something
|
||||
}
|
||||
}
|
||||
})
|
||||
time.Sleep(time.Second)
|
||||
executor.StopAndWaitForever()
|
||||
fmt.Println("executor stopped")
|
||||
// output:
|
||||
// goroutine exited
|
||||
// executor stopped
|
||||
}
|
||||
|
||||
func ExampleUnboundedExecutor_Go_panic() {
|
||||
concurrent.HandlePanic = func(recovered interface{}, funcName string) {
|
||||
fmt.Println(funcName)
|
||||
}
|
||||
executor := concurrent.NewUnboundedExecutor()
|
||||
executor.Go(willPanic)
|
||||
time.Sleep(time.Second)
|
||||
// output:
|
||||
// github.com/modern-go/concurrent_test.willPanic
|
||||
}
|
||||
|
||||
func willPanic(ctx context.Context) {
|
||||
panic("!!!")
|
||||
}
|
||||
Reference in New Issue
Block a user