mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-04 03:03:14 -05:00 
			
		
		
		
	Update client-go to v10.0.0 (Kubernetes 1.13) (#2382)
* Update client-go to v10.0.0 (Kubernetes 1.13) This fix updates client-go to v10.0.0 which matches Kubernetes 1.13 (released several days ago). Other changes in Gopkg.yaml: - Updated apimachinary, api, klog, yaml associated with k8s version go dep will not automatically match the version. - Added [prune] field (otherwise go dep will not prune automatically) Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Updated Gopkg.lock Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Updated vendor for client-go v10.0.0 Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
		
							
								
								
									
										1
									
								
								vendor/github.com/modern-go/concurrent/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/modern-go/concurrent/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1 +0,0 @@
 | 
			
		||||
/coverage.txt
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/github.com/modern-go/concurrent/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/modern-go/concurrent/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,14 +0,0 @@
 | 
			
		||||
language: go
 | 
			
		||||
 | 
			
		||||
go:
 | 
			
		||||
  - 1.8.x
 | 
			
		||||
  - 1.x
 | 
			
		||||
 | 
			
		||||
before_install:
 | 
			
		||||
  - go get -t -v ./...
 | 
			
		||||
 | 
			
		||||
script:
 | 
			
		||||
  - ./test.sh
 | 
			
		||||
 | 
			
		||||
after_success:
 | 
			
		||||
  - bash <(curl -s https://codecov.io/bash)
 | 
			
		||||
							
								
								
									
										49
									
								
								vendor/github.com/modern-go/concurrent/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										49
									
								
								vendor/github.com/modern-go/concurrent/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,49 +0,0 @@
 | 
			
		||||
# concurrent
 | 
			
		||||
 | 
			
		||||
[](https://sourcegraph.com/github.com/modern-go/concurrent?badge)
 | 
			
		||||
[](http://godoc.org/github.com/modern-go/concurrent)
 | 
			
		||||
[](https://travis-ci.org/modern-go/concurrent)
 | 
			
		||||
[](https://codecov.io/gh/modern-go/concurrent)
 | 
			
		||||
[](https://goreportcard.com/report/github.com/modern-go/concurrent)
 | 
			
		||||
[](https://raw.githubusercontent.com/modern-go/concurrent/master/LICENSE)
 | 
			
		||||
 | 
			
		||||
* concurrent.Map: backport sync.Map for go below 1.9
 | 
			
		||||
* concurrent.Executor: goroutine with explicit ownership and cancellable
 | 
			
		||||
 | 
			
		||||
# concurrent.Map
 | 
			
		||||
 | 
			
		||||
because sync.Map is only available in go 1.9, we can use concurrent.Map to make code portable
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
m := concurrent.NewMap()
 | 
			
		||||
m.Store("hello", "world")
 | 
			
		||||
elem, found := m.Load("hello")
 | 
			
		||||
// elem will be "world"
 | 
			
		||||
// found will be true
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# concurrent.Executor
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
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")
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
attach goroutine to executor instance, so that we can
 | 
			
		||||
 | 
			
		||||
* cancel it by stop the executor with Stop/StopAndWait/StopAndWaitForever
 | 
			
		||||
* handle panic by callback: the default behavior will no longer crash your application
 | 
			
		||||
							
								
								
									
										12
									
								
								vendor/github.com/modern-go/concurrent/test.sh
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								vendor/github.com/modern-go/concurrent/test.sh
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,12 +0,0 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
echo "" > coverage.txt
 | 
			
		||||
 | 
			
		||||
for d in $(go list ./... | grep -v vendor); do
 | 
			
		||||
    go test -coverprofile=profile.out -coverpkg=github.com/modern-go/concurrent $d
 | 
			
		||||
    if [ -f profile.out ]; then
 | 
			
		||||
        cat profile.out >> coverage.txt
 | 
			
		||||
        rm profile.out
 | 
			
		||||
    fi
 | 
			
		||||
done
 | 
			
		||||
		Reference in New Issue
	
	Block a user