diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index d0a92342c1..c4a7abc953 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -2520,8 +2520,8 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Comment": "1.0.0-9-g05fbef0", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Comment": "v1.0.1", + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/mohae/deepcopy", diff --git a/staging/src/k8s.io/api/Godeps/Godeps.json b/staging/src/k8s.io/api/Godeps/Godeps.json index 6d345b2382..7fa2351787 100644 --- a/staging/src/k8s.io/api/Godeps/Godeps.json +++ b/staging/src/k8s.io/api/Godeps/Godeps.json @@ -44,7 +44,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/pmezard/go-difflib/difflib", diff --git a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json index a807ce3115..2f70977e25 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiextensions-apiserver/Godeps/Godeps.json @@ -572,7 +572,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/pborman/uuid", diff --git a/staging/src/k8s.io/apimachinery/Godeps/Godeps.json b/staging/src/k8s.io/apimachinery/Godeps/Godeps.json index ba33fb991c..ab975f4fda 100644 --- a/staging/src/k8s.io/apimachinery/Godeps/Godeps.json +++ b/staging/src/k8s.io/apimachinery/Godeps/Godeps.json @@ -100,7 +100,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/mxk/go-flowrate/flowrate", diff --git a/staging/src/k8s.io/apiserver/Godeps/Godeps.json b/staging/src/k8s.io/apiserver/Godeps/Godeps.json index 57ebc2154b..7ee99efd80 100644 --- a/staging/src/k8s.io/apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/apiserver/Godeps/Godeps.json @@ -544,7 +544,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/pborman/uuid", diff --git a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json index 9458287ff0..170cc17151 100644 --- a/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json +++ b/staging/src/k8s.io/cli-runtime/Godeps/Godeps.json @@ -96,7 +96,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/peterbourgon/diskv", diff --git a/staging/src/k8s.io/client-go/Godeps/Godeps.json b/staging/src/k8s.io/client-go/Godeps/Godeps.json index 7966502990..9076b4032c 100644 --- a/staging/src/k8s.io/client-go/Godeps/Godeps.json +++ b/staging/src/k8s.io/client-go/Godeps/Godeps.json @@ -168,7 +168,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/peterbourgon/diskv", diff --git a/staging/src/k8s.io/csi-api/Godeps/Godeps.json b/staging/src/k8s.io/csi-api/Godeps/Godeps.json index d326856ae1..81318ce2ac 100644 --- a/staging/src/k8s.io/csi-api/Godeps/Godeps.json +++ b/staging/src/k8s.io/csi-api/Godeps/Godeps.json @@ -92,7 +92,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/peterbourgon/diskv", diff --git a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json index a4ae3ae5fd..4c5901100b 100644 --- a/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json +++ b/staging/src/k8s.io/kube-aggregator/Godeps/Godeps.json @@ -260,7 +260,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/mxk/go-flowrate/flowrate", diff --git a/staging/src/k8s.io/metrics/Godeps/Godeps.json b/staging/src/k8s.io/metrics/Godeps/Godeps.json index 5a2e5ba459..b764ae3111 100644 --- a/staging/src/k8s.io/metrics/Godeps/Godeps.json +++ b/staging/src/k8s.io/metrics/Godeps/Godeps.json @@ -84,7 +84,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/peterbourgon/diskv", diff --git a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json index 94fb060437..7003a50e3c 100644 --- a/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-apiserver/Godeps/Godeps.json @@ -252,7 +252,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/pborman/uuid", diff --git a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json index 2e5854d5c6..3b77611e6c 100644 --- a/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-cli-plugin/Godeps/Godeps.json @@ -92,7 +92,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/peterbourgon/diskv", diff --git a/staging/src/k8s.io/sample-controller/Godeps/Godeps.json b/staging/src/k8s.io/sample-controller/Godeps/Godeps.json index 5100e609c8..afe92d652a 100644 --- a/staging/src/k8s.io/sample-controller/Godeps/Godeps.json +++ b/staging/src/k8s.io/sample-controller/Godeps/Godeps.json @@ -100,7 +100,7 @@ }, { "ImportPath": "github.com/modern-go/reflect2", - "Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd" + "Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8" }, { "ImportPath": "github.com/peterbourgon/diskv", diff --git a/vendor/github.com/modern-go/reflect2/.travis.yml b/vendor/github.com/modern-go/reflect2/.travis.yml index 449e67cd01..fbb43744d9 100644 --- a/vendor/github.com/modern-go/reflect2/.travis.yml +++ b/vendor/github.com/modern-go/reflect2/.travis.yml @@ -6,6 +6,7 @@ go: before_install: - go get -t -v ./... + - go get -t -v github.com/modern-go/reflect2-tests/... script: - ./test.sh diff --git a/vendor/github.com/modern-go/reflect2/Gopkg.toml b/vendor/github.com/modern-go/reflect2/Gopkg.toml index 3593fd0417..2f4f4dbdcc 100644 --- a/vendor/github.com/modern-go/reflect2/Gopkg.toml +++ b/vendor/github.com/modern-go/reflect2/Gopkg.toml @@ -24,7 +24,7 @@ # go-tests = true # unused-packages = true -ignored = ["github.com/modern-go/test","github.com/modern-go/test/must","github.com/modern-go/test/should"] +ignored = [] [[constraint]] name = "github.com/modern-go/concurrent" diff --git a/vendor/github.com/modern-go/reflect2/reflect2.go b/vendor/github.com/modern-go/reflect2/reflect2.go index 0632b71fb0..63b49c7991 100644 --- a/vendor/github.com/modern-go/reflect2/reflect2.go +++ b/vendor/github.com/modern-go/reflect2/reflect2.go @@ -150,6 +150,9 @@ func (cfg *frozenConfig) TypeOf(obj interface{}) Type { } func (cfg *frozenConfig) Type2(type1 reflect.Type) Type { + if type1 == nil { + return nil + } cacheKey := uintptr(unpackEFace(type1).data) typeObj, found := cfg.cache.Load(cacheKey) if found { diff --git a/vendor/github.com/modern-go/reflect2/test.sh b/vendor/github.com/modern-go/reflect2/test.sh index fbcef73098..3d2b9768ce 100755 --- a/vendor/github.com/modern-go/reflect2/test.sh +++ b/vendor/github.com/modern-go/reflect2/test.sh @@ -3,7 +3,7 @@ set -e echo "" > coverage.txt -for d in $(go list ./... | grep -v vendor); do +for d in $(go list github.com/modern-go/reflect2-tests/... | grep -v vendor); do go test -coverprofile=profile.out -coverpkg=github.com/modern-go/reflect2 $d if [ -f profile.out ]; then cat profile.out >> coverage.txt diff --git a/vendor/github.com/modern-go/reflect2/type_map.go b/vendor/github.com/modern-go/reflect2/type_map.go index 6d489112ff..3acfb55803 100644 --- a/vendor/github.com/modern-go/reflect2/type_map.go +++ b/vendor/github.com/modern-go/reflect2/type_map.go @@ -4,6 +4,7 @@ import ( "reflect" "runtime" "strings" + "sync" "unsafe" ) @@ -15,10 +16,17 @@ func typelinks1() [][]unsafe.Pointer //go:linkname typelinks2 reflect.typelinks func typelinks2() (sections []unsafe.Pointer, offset [][]int32) -var types = map[string]reflect.Type{} -var packages = map[string]map[string]reflect.Type{} +// initOnce guards initialization of types and packages +var initOnce sync.Once + +var types map[string]reflect.Type +var packages map[string]map[string]reflect.Type + +// discoverTypes initializes types and packages +func discoverTypes() { + types = make(map[string]reflect.Type) + packages = make(map[string]map[string]reflect.Type) -func init() { ver := runtime.Version() if ver == "go1.5" || strings.HasPrefix(ver, "go1.5.") { loadGo15Types() @@ -90,11 +98,13 @@ type emptyInterface struct { // TypeByName return the type by its name, just like Class.forName in java func TypeByName(typeName string) Type { + initOnce.Do(discoverTypes) return Type2(types[typeName]) } // TypeByPackageName return the type by its package and name func TypeByPackageName(pkgPath string, name string) Type { + initOnce.Do(discoverTypes) pkgTypes := packages[pkgPath] if pkgTypes == nil { return nil