From 7e63bdbee8340d3ce2d2488f93d0fb1d4d16a201 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Mon, 28 Aug 2017 17:49:28 +0200 Subject: dep ensure -update (#1001) * dep ensure -update Run "dep ensure -update` to update all dependencies. No code changes; just the dependencies. * dep prune * add new venderod --- vendor/github.com/go-openapi/swag/json.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'vendor/github.com/go-openapi/swag/json.go') diff --git a/vendor/github.com/go-openapi/swag/json.go b/vendor/github.com/go-openapi/swag/json.go index 0eb374467..cb20a6a0f 100644 --- a/vendor/github.com/go-openapi/swag/json.go +++ b/vendor/github.com/go-openapi/swag/json.go @@ -237,6 +237,8 @@ func newNameIndex(tpe reflect.Type) nameIndex { // GetJSONNames gets all the json property names for a type func (n *NameProvider) GetJSONNames(subject interface{}) []string { + n.lock.Lock() + defer n.lock.Unlock() tpe := reflect.Indirect(reflect.ValueOf(subject)).Type() names, ok := n.index[tpe] if !ok { @@ -258,6 +260,8 @@ func (n *NameProvider) GetJSONName(subject interface{}, name string) (string, bo // GetJSONNameForType gets the json name for a go property name on a given type func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string, bool) { + n.lock.Lock() + defer n.lock.Unlock() names, ok := n.index[tpe] if !ok { names = n.makeNameIndex(tpe) @@ -267,8 +271,6 @@ func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string } func (n *NameProvider) makeNameIndex(tpe reflect.Type) nameIndex { - n.lock.Lock() - defer n.lock.Unlock() names := newNameIndex(tpe) n.index[tpe] = names return names @@ -282,6 +284,8 @@ func (n *NameProvider) GetGoName(subject interface{}, name string) (string, bool // GetGoNameForType gets the go name for a given type for a json property name func (n *NameProvider) GetGoNameForType(tpe reflect.Type, name string) (string, bool) { + n.lock.Lock() + defer n.lock.Unlock() names, ok := n.index[tpe] if !ok { names = n.makeNameIndex(tpe) -- cgit v1.2.3