From c8fd0be03c80daa982240642ca7d23287aa78119 Mon Sep 17 00:00:00 2001 From: Lang Martin Date: Thu, 25 Apr 2019 16:35:31 -0400 Subject: [PATCH] govendor fetch github.com/hashicorp/hcl@99e2f22 --- vendor/github.com/hashicorp/hcl/decoder.go | 19 ++++++++++--------- vendor/vendor.json | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/vendor/github.com/hashicorp/hcl/decoder.go b/vendor/github.com/hashicorp/hcl/decoder.go index c3031aef1..5e32563c0 100644 --- a/vendor/github.com/hashicorp/hcl/decoder.go +++ b/vendor/github.com/hashicorp/hcl/decoder.go @@ -404,20 +404,21 @@ func (d *decoder) decodeMap(name string, node ast.Node, result reflect.Value) er } func (d *decoder) decodePtr(name string, node ast.Node, result reflect.Value) error { - // lookup the concrete (non pointer) type and decode into that - // if the pointer is nil, create an element of the type and set the pointer to that - resultType := result.Type() - val := reflect.Indirect(result) - if val.Kind() == reflect.Invalid || val == reflect.Zero(resultType) { - resultElemType := resultType.Elem() - val = reflect.New(resultElemType) - result.Set(val) + // if pointer is not nil, decode into existing value + if !result.IsNil() { + return d.decode(name, node, result.Elem()) } + // Create an element of the concrete (non pointer) type and decode + // into that. Then set the value of the pointer to this type. + resultType := result.Type() + resultElemType := resultType.Elem() + val := reflect.New(resultElemType) if err := d.decode(name, node, reflect.Indirect(val)); err != nil { return err } + result.Set(val) return nil } @@ -516,7 +517,7 @@ func expandObject(node ast.Node, result reflect.Value) ast.Node { // we need to un-flatten the ast enough to decode newNode := &ast.ObjectItem{ Keys: []*ast.ObjectKey{ - &ast.ObjectKey{ + { Token: keyToken, }, }, diff --git a/vendor/vendor.json b/vendor/vendor.json index a25beb9eb..20de66fd7 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -206,7 +206,7 @@ {"path":"github.com/hashicorp/go-version","checksumSHA1":"r0pj5dMHCghpaQZ3f1BRGoKiSWw=","revision":"b5a281d3160aa11950a6182bd9a9dc2cb1e02d50","revisionTime":"2018-08-24T00:43:55Z"}, {"path":"github.com/hashicorp/golang-lru","checksumSHA1":"d9PxF1XQGLMJZRct2R8qVM/eYlE=","revision":"a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4","revisionTime":"2016-02-07T21:47:19Z"}, {"path":"github.com/hashicorp/golang-lru/simplelru","checksumSHA1":"2nOpYjx8Sn57bqlZq17yM4YJuM4=","revision":"a0d98a5f288019575c6d1f4bb1573fef2d1fcdc4"}, - {"path":"github.com/hashicorp/hcl","checksumSHA1":"92YRhJZwHqlobSQ7QUCFyo6/Rss=","revision":"fe9505115539fd1dfa29a42202987befc8d536ef","revisionTime":"2019-04-22T15:22:51Z"}, + {"path":"github.com/hashicorp/hcl","checksumSHA1":"bPPNuq11pA/YSJzwxS0163WnhCo=","revision":"99e2f22d1c94b272184d97dd9d252866409100ab","revisionTime":"2019-04-30T13:52:23Z"}, {"path":"github.com/hashicorp/hcl/hcl/ast","checksumSHA1":"XQmjDva9JCGGkIecOgwtBEMCJhU=","revision":"6e968a3fcdcbab092f5307fd0d85479d5af1e4dc","revisionTime":"2016-11-01T18:00:25Z"}, {"path":"github.com/hashicorp/hcl/hcl/parser","checksumSHA1":"croNloscHsjX87X+4/cKOURf1EY=","revision":"6e968a3fcdcbab092f5307fd0d85479d5af1e4dc","revisionTime":"2016-11-01T18:00:25Z"}, {"path":"github.com/hashicorp/hcl/hcl/scanner","checksumSHA1":"lgR7PSAZ0RtvAc9OCtCnNsF/x8g=","revision":"6e968a3fcdcbab092f5307fd0d85479d5af1e4dc","revisionTime":"2016-11-01T18:00:25Z"},