mirror of https://github.com/docker/cli.git
vendor: github.com/modern-go/reflect2 v1.0.1
Previous vendor was using the 1.0.1 tag (without v-prefix). diff: https://github.com/modern-go/reflect2/compare/1.0.1...v1.0.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
d6c55a105f
commit
2cbb88f4c9
|
@ -51,7 +51,7 @@ github.com/moby/buildkit 8142d66b5ebde79846b869fba30d
|
||||||
github.com/moby/sys b0f1fd7235275d01bd35cc4421e884e522395f45 # mountinfo/v0.4.1 (latest tag, either mount/vXXX, mountinfo/vXXX or symlink/vXXX)
|
github.com/moby/sys b0f1fd7235275d01bd35cc4421e884e522395f45 # mountinfo/v0.4.1 (latest tag, either mount/vXXX, mountinfo/vXXX or symlink/vXXX)
|
||||||
github.com/moby/term 3f7ff695adc6a35abc925370dd0a4dafb48ec64d
|
github.com/moby/term 3f7ff695adc6a35abc925370dd0a4dafb48ec64d
|
||||||
github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3
|
github.com/modern-go/concurrent bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94 # 1.0.3
|
||||||
github.com/modern-go/reflect2 4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd # 1.0.1
|
github.com/modern-go/reflect2 94122c33edd36123c84d5368cfb2b69df93a0ec8 # v1.0.1
|
||||||
github.com/morikuni/aec 39771216ff4c63d11f5e604076f9c45e8be1067b # v1.0.0
|
github.com/morikuni/aec 39771216ff4c63d11f5e604076f9c45e8be1067b # v1.0.0
|
||||||
github.com/opencontainers/go-digest ea51bea511f75cfa3ef6098cc253c5c3609b037a # v1.0.0
|
github.com/opencontainers/go-digest ea51bea511f75cfa3ef6098cc253c5c3609b037a # v1.0.0
|
||||||
github.com/opencontainers/image-spec d60099175f88c47cd379c4738d158884749ed235 # v1.0.1
|
github.com/opencontainers/image-spec d60099175f88c47cd379c4738d158884749ed235 # v1.0.1
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,10 +16,17 @@ func typelinks1() [][]unsafe.Pointer
|
||||||
//go:linkname typelinks2 reflect.typelinks
|
//go:linkname typelinks2 reflect.typelinks
|
||||||
func typelinks2() (sections []unsafe.Pointer, offset [][]int32)
|
func typelinks2() (sections []unsafe.Pointer, offset [][]int32)
|
||||||
|
|
||||||
var types = map[string]reflect.Type{}
|
// initOnce guards initialization of types and packages
|
||||||
var packages = map[string]map[string]reflect.Type{}
|
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()
|
ver := runtime.Version()
|
||||||
if ver == "go1.5" || strings.HasPrefix(ver, "go1.5.") {
|
if ver == "go1.5" || strings.HasPrefix(ver, "go1.5.") {
|
||||||
loadGo15Types()
|
loadGo15Types()
|
||||||
|
@ -90,11 +98,13 @@ type emptyInterface struct {
|
||||||
|
|
||||||
// TypeByName return the type by its name, just like Class.forName in java
|
// TypeByName return the type by its name, just like Class.forName in java
|
||||||
func TypeByName(typeName string) Type {
|
func TypeByName(typeName string) Type {
|
||||||
|
initOnce.Do(discoverTypes)
|
||||||
return Type2(types[typeName])
|
return Type2(types[typeName])
|
||||||
}
|
}
|
||||||
|
|
||||||
// TypeByPackageName return the type by its package and name
|
// TypeByPackageName return the type by its package and name
|
||||||
func TypeByPackageName(pkgPath string, name string) Type {
|
func TypeByPackageName(pkgPath string, name string) Type {
|
||||||
|
initOnce.Do(discoverTypes)
|
||||||
pkgTypes := packages[pkgPath]
|
pkgTypes := packages[pkgPath]
|
||||||
if pkgTypes == nil {
|
if pkgTypes == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue