mirror of https://github.com/k3s-io/k3s
Merge pull request #68238 from justinsb/update_reflect2_to_101
Update reflect2 to 1.0.1 (memory utilization fix)pull/58/head
commit
a94ea824eb
|
@ -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",
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pmezard/go-difflib/difflib",
|
||||
|
|
|
@ -572,7 +572,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pborman/uuid",
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mxk/go-flowrate/flowrate",
|
||||
|
|
|
@ -544,7 +544,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pborman/uuid",
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/peterbourgon/diskv",
|
||||
|
|
|
@ -168,7 +168,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/peterbourgon/diskv",
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/peterbourgon/diskv",
|
||||
|
|
|
@ -260,7 +260,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mxk/go-flowrate/flowrate",
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/peterbourgon/diskv",
|
||||
|
|
|
@ -252,7 +252,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/pborman/uuid",
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/peterbourgon/diskv",
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/modern-go/reflect2",
|
||||
"Rev": "05fbef0ca5da472bbf96c9322b84a53edc03c9fd"
|
||||
"Rev": "94122c33edd36123c84d5368cfb2b69df93a0ec8"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/peterbourgon/diskv",
|
||||
|
|
|
@ -6,6 +6,7 @@ go:
|
|||
|
||||
before_install:
|
||||
- go get -t -v ./...
|
||||
- go get -t -v github.com/modern-go/reflect2-tests/...
|
||||
|
||||
script:
|
||||
- ./test.sh
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue