From f5d151a2341245bd22f6a64c744eadd61e01539d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2020 08:16:44 +0000 Subject: Bump github.com/gorilla/schema from 1.1.0 to 1.2.0 Bumps [github.com/gorilla/schema](https://github.com/gorilla/schema) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/gorilla/schema/releases) - [Commits](https://github.com/gorilla/schema/compare/v1.1.0...v1.2.0) Signed-off-by: dependabot-preview[bot] Signed-off-by: Daniel J Walsh --- vendor/github.com/gorilla/schema/.travis.yml | 18 ------------------ vendor/github.com/gorilla/schema/decoder.go | 19 ++++++++++++++++++- vendor/github.com/gorilla/schema/encoder.go | 7 +++++++ vendor/modules.txt | 2 +- 4 files changed, 26 insertions(+), 20 deletions(-) delete mode 100644 vendor/github.com/gorilla/schema/.travis.yml (limited to 'vendor') diff --git a/vendor/github.com/gorilla/schema/.travis.yml b/vendor/github.com/gorilla/schema/.travis.yml deleted file mode 100644 index 5f51dce4e..000000000 --- a/vendor/github.com/gorilla/schema/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: go -sudo: false - -matrix: - include: - - go: 1.5 - - go: 1.6 - - go: 1.7 - - go: 1.8 - - go: tip - allow_failures: - - go: tip - -script: - - go get -t -v ./... - - diff -u <(echo -n) <(gofmt -d .) - - go vet $(go list ./... | grep -v /vendor/) - - go test -v -race ./... diff --git a/vendor/github.com/gorilla/schema/decoder.go b/vendor/github.com/gorilla/schema/decoder.go index 5afbd921f..025e438b5 100644 --- a/vendor/github.com/gorilla/schema/decoder.go +++ b/vendor/github.com/gorilla/schema/decoder.go @@ -152,9 +152,15 @@ type fieldWithPrefix struct { func isEmptyFields(fields []fieldWithPrefix, src map[string][]string) bool { for _, f := range fields { for _, path := range f.paths(f.prefix) { - if !isEmpty(f.typ, src[path]) { + v, ok := src[path] + if ok && !isEmpty(f.typ, v) { return false } + for key := range src { + if !isEmpty(f.typ, src[key]) && strings.HasPrefix(key, path) { + return false + } + } } } return true @@ -182,6 +188,17 @@ func (d *Decoder) decode(v reflect.Value, path string, parts []pathPart, values } v = v.Elem() } + + // alloc embedded structs + if v.Type().Kind() == reflect.Struct { + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + if field.Type().Kind() == reflect.Ptr && field.IsNil() && v.Type().Field(i).Anonymous == true { + field.Set(reflect.New(field.Type().Elem())) + } + } + } + v = v.FieldByName(name) } // Don't even bother for unexported fields. diff --git a/vendor/github.com/gorilla/schema/encoder.go b/vendor/github.com/gorilla/schema/encoder.go index bf1d511e6..f0ed63121 100644 --- a/vendor/github.com/gorilla/schema/encoder.go +++ b/vendor/github.com/gorilla/schema/encoder.go @@ -57,6 +57,13 @@ func isZero(v reflect.Value) bool { } return z case reflect.Struct: + type zero interface { + IsZero() bool + } + if v.Type().Implements(reflect.TypeOf((*zero)(nil)).Elem()) { + iz := v.MethodByName("IsZero").Call([]reflect.Value{})[0] + return iz.Interface().(bool) + } z := true for i := 0; i < v.NumField(); i++ { z = z && isZero(v.Field(i)) diff --git a/vendor/modules.txt b/vendor/modules.txt index c6571d217..13d162650 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -305,7 +305,7 @@ github.com/google/shlex github.com/google/uuid # github.com/gorilla/mux v1.7.4 github.com/gorilla/mux -# github.com/gorilla/schema v1.1.0 +# github.com/gorilla/schema v1.2.0 github.com/gorilla/schema # github.com/hashicorp/errwrap v1.0.0 github.com/hashicorp/errwrap -- cgit v1.2.3-54-g00ecf