diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2021-04-03 13:18:17 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2021-04-03 14:23:00 -0400 |
| commit | d334a3619a9897ff43b76b8f60fa1a0a41b9cbe9 (patch) | |
| tree | 97f9fe27182604e41f08183fc42a2e4b4bded7ba | |
| parent | 507d41ae8a2536584eb032c98abc46496a77ea86 (diff) | |
Update linting and fix field alignment issues
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
30 files changed, 402 insertions, 375 deletions
diff --git a/.golangci.yml b/.golangci.yml index d8d82efb..3a693aff 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,12 +1,12 @@ linters-settings: govet: check-shadowing: true + enable: + - fieldalignment golint: min-confidence: 0 gocyclo: min-complexity: 10 - maligned: - suggest-new: true dupl: threshold: 100 goconst: @@ -53,9 +53,7 @@ linters: - gosimple - govet - ineffassign - # - interfacer # - lll - - maligned - misspell - nakedret - nestif @@ -64,7 +62,6 @@ linters: # - nolintlint - prealloc - rowserrcheck - - scopelint - sqlclosecheck - staticcheck - structcheck @@ -80,6 +77,3 @@ linters: run: concurrency: 4 timeout: 5m - build-tags: - - "" - - integration diff --git a/aws/ec2meta.go b/aws/ec2meta.go index 72ee6f26..4165214c 100644 --- a/aws/ec2meta.go +++ b/aws/ec2meta.go @@ -22,11 +22,11 @@ const ( // Ec2Meta - type Ec2Meta struct { - Endpoint string Client *http.Client - nonAWS bool cache map[string]string + Endpoint string options ClientOptions + nonAWS bool } // NewEc2Meta - diff --git a/aws/sts_test.go b/aws/sts_test.go index df66288e..85bbeccd 100644 --- a/aws/sts_test.go +++ b/aws/sts_test.go @@ -88,8 +88,8 @@ func TestGetCallerIDErrors(t *testing.T) { } type DummyCallerIdentifier struct { - account, arn, userID string err error + account, arn, userID string } func (c *DummyCallerIdentifier) GetCallerIdentity(*sts.GetCallerIdentityInput) (*sts.GetCallerIdentityOutput, error) { diff --git a/aws/testutils.go b/aws/testutils.go index 8db7bb6c..9f4c0240 100644 --- a/aws/testutils.go +++ b/aws/testutils.go @@ -13,7 +13,13 @@ import ( func MockServer(code int, body string) (*httptest.Server, *Ec2Meta) { server, httpClient := MockHTTPServer(code, body) - client := &Ec2Meta{server.URL + "/", httpClient, false, make(map[string]string), ClientOptions{}} + client := &Ec2Meta{ + Client: httpClient, + cache: make(map[string]string), + Endpoint: server.URL + "/", + options: ClientOptions{}, + nonAWS: false, + } return server, client } diff --git a/coll/coll_test.go b/coll/coll_test.go index 72d6b372..fa858b55 100644 --- a/coll/coll_test.go +++ b/coll/coll_test.go @@ -43,16 +43,16 @@ func TestHas(t *testing.T) { func TestDict(t *testing.T) { testdata := []struct { - args []interface{} expected map[string]interface{} + args []interface{} }{ - {nil, map[string]interface{}{}}, - {[]interface{}{}, map[string]interface{}{}}, - {[]interface{}{"foo"}, map[string]interface{}{"foo": ""}}, - {[]interface{}{42}, map[string]interface{}{"42": ""}}, - {[]interface{}{"foo", nil}, map[string]interface{}{"foo": nil}}, - {[]interface{}{"foo", "bar"}, map[string]interface{}{"foo": "bar"}}, - {[]interface{}{"foo", "bar", "baz", true}, map[string]interface{}{ + {expected: map[string]interface{}{}}, + {args: []interface{}{}, expected: map[string]interface{}{}}, + {args: []interface{}{"foo"}, expected: map[string]interface{}{"foo": ""}}, + {args: []interface{}{42}, expected: map[string]interface{}{"42": ""}}, + {args: []interface{}{"foo", nil}, expected: map[string]interface{}{"foo": nil}}, + {args: []interface{}{"foo", "bar"}, expected: map[string]interface{}{"foo": "bar"}}, + {args: []interface{}{"foo", "bar", "baz", true}, expected: map[string]interface{}{ "foo": "bar", "baz": true, }}, @@ -307,27 +307,36 @@ func TestSameTypes(t *testing.T) { func TestLessThan(t *testing.T) { data := []struct { - key string left, right interface{} + key string out bool }{ - {"", nil, nil, false}, - {"", "a", "b", true}, - {"", "a", "a", false}, - {"", "b", "a", false}, - {"", 1.00, 3.14, true}, - {"", 'a', 'A', false}, - {"", 'a', 'b', true}, - {"", uint(0xff), uint(0x32), false}, - {"", 1, 3, true}, - {"", true, false, false}, - {"", map[string]interface{}{"foo": 1}, map[string]interface{}{"foo": 2}, false}, - {"foo", map[string]interface{}{"foo": 1}, map[string]interface{}{"foo": 2}, true}, - {"bar", map[string]interface{}{"foo": 1}, map[string]interface{}{"foo": 2}, false}, - {"X", coords{}, coords{-1, 2}, false}, - {"Y", &coords{1, 1}, &coords{-1, 2}, true}, - {"", &coords{1, 1}, &coords{-1, 2}, false}, - {"foo", &coords{1, 1}, &coords{-1, 2}, false}, + {key: ""}, + {left: "a", right: "b", out: true}, + {left: "a", right: "a"}, + {left: "b", right: "a"}, + {left: 1.00, right: 3.14, out: true}, + {left: 'a', right: 'A'}, + {left: 'a', right: 'b', out: true}, + {left: uint(0xff), right: uint(0x32)}, + {left: 1, right: 3, out: true}, + {left: true, right: false, out: false}, + {left: map[string]interface{}{"foo": 1}, right: map[string]interface{}{"foo": 2}}, + { + key: "foo", + left: map[string]interface{}{"foo": 1}, + right: map[string]interface{}{"foo": 2}, + out: true, + }, + { + key: "bar", + left: map[string]interface{}{"foo": 1}, + right: map[string]interface{}{"foo": 2}, + }, + {key: "X", left: coords{}, right: coords{-1, 2}}, + {key: "Y", left: &coords{1, 1}, right: &coords{-1, 2}, out: true}, + {left: &coords{1, 1}, right: &coords{-1, 2}}, + {key: "foo", left: &coords{1, 1}, right: &coords{-1, 2}}, } for _, d := range data { @@ -461,38 +470,32 @@ func TestSort(t *testing.T) { func TestFlatten(t *testing.T) { data := []struct { - depth int in interface{} expected []interface{} + depth int }{ - {0, []int{1, 2, 3}, []interface{}{1, 2, 3}}, - {0, [3]int{1, 2, 3}, []interface{}{1, 2, 3}}, - {0, - []interface{}{[]string{}, []int{1, 2}, 3}, - []interface{}{[]string{}, []int{1, 2}, 3}, + {in: []int{1, 2, 3}, expected: []interface{}{1, 2, 3}}, + {in: [3]int{1, 2, 3}, expected: []interface{}{1, 2, 3}}, + {in: []interface{}{[]string{}, []int{1, 2}, 3}, expected: []interface{}{[]string{}, []int{1, 2}, 3}}, + {in: []interface{}{[]string{"one"}, [][]int{{1, 2}}, 3}, + expected: []interface{}{[]string{"one"}, [][]int{{1, 2}}, 3}, }, - {0, - []interface{}{[]string{"one"}, [][]int{{1, 2}}, 3}, - []interface{}{[]string{"one"}, [][]int{{1, 2}}, 3}, - }, - - {1, []int{1, 2, 3}, []interface{}{1, 2, 3}}, - {1, [3]int{1, 2, 3}, []interface{}{1, 2, 3}}, - {1, []interface{}{[]string{}, []int{1, 2}, 3}, []interface{}{1, 2, 3}}, - {1, - []interface{}{[]string{"one"}, [][]int{{1, 2}}, 3}, - []interface{}{"one", []int{1, 2}, 3}, + {depth: 1, in: []int{1, 2, 3}, expected: []interface{}{1, 2, 3}}, + {depth: 1, in: [3]int{1, 2, 3}, expected: []interface{}{1, 2, 3}}, + {depth: 1, in: []interface{}{[]string{}, []int{1, 2}, 3}, expected: []interface{}{1, 2, 3}}, + {depth: 1, + in: []interface{}{[]string{"one"}, [][]int{{1, 2}}, 3}, + expected: []interface{}{"one", []int{1, 2}, 3}, }, - - {2, []int{1, 2, 3}, []interface{}{1, 2, 3}}, - {2, [3]int{1, 2, 3}, []interface{}{1, 2, 3}}, - {2, []interface{}{[]string{}, []int{1, 2}, 3}, []interface{}{1, 2, 3}}, - {2, - []interface{}{[]string{"one"}, [][]int{{1, 2}}, 3}, - []interface{}{"one", 1, 2, 3}, + {depth: 2, in: []int{1, 2, 3}, expected: []interface{}{1, 2, 3}}, + {depth: 2, in: [3]int{1, 2, 3}, expected: []interface{}{1, 2, 3}}, + {depth: 2, in: []interface{}{[]string{}, []int{1, 2}, 3}, expected: []interface{}{1, 2, 3}}, + {depth: 2, + in: []interface{}{[]string{"one"}, [][]int{{1, 2}}, 3}, + expected: []interface{}{"one", 1, 2, 3}, }, - {2, - []interface{}{ + {depth: 2, + in: []interface{}{ []string{"one"}, []interface{}{ []interface{}{ @@ -503,18 +506,17 @@ func TestFlatten(t *testing.T) { }, 6, }, - []interface{}{"one", []int{1}, []interface{}{2, []int{3}}, 4, 5, 6}, + expected: []interface{}{"one", []int{1}, []interface{}{2, []int{3}}, 4, 5, 6}, }, - - {-1, []int{1, 2, 3}, []interface{}{1, 2, 3}}, - {-1, [3]int{1, 2, 3}, []interface{}{1, 2, 3}}, - {-1, []interface{}{[]string{}, []int{1, 2}, 3}, []interface{}{1, 2, 3}}, - {-1, - []interface{}{[]string{"one"}, [][]int{{1, 2}}, 3}, - []interface{}{"one", 1, 2, 3}, + {depth: -1, in: []int{1, 2, 3}, expected: []interface{}{1, 2, 3}}, + {depth: -1, in: [3]int{1, 2, 3}, expected: []interface{}{1, 2, 3}}, + {depth: -1, in: []interface{}{[]string{}, []int{1, 2}, 3}, expected: []interface{}{1, 2, 3}}, + {depth: -1, + in: []interface{}{[]string{"one"}, [][]int{{1, 2}}, 3}, + expected: []interface{}{"one", 1, 2, 3}, }, - {-1, - []interface{}{ + {depth: -1, + in: []interface{}{ []string{"one"}, []interface{}{ []interface{}{ @@ -525,7 +527,7 @@ func TestFlatten(t *testing.T) { }, 6, }, - []interface{}{"one", 1, 2, 3, 4, 5, 6}, + expected: []interface{}{"one", 1, 2, 3, 4, 5, 6}, }, } diff --git a/conv/conv_test.go b/conv/conv_test.go index edc0de2f..62167a49 100644 --- a/conv/conv_test.go +++ b/conv/conv_test.go @@ -308,19 +308,31 @@ func TestToBool(t *testing.T) { func TestDict(t *testing.T) { testdata := []struct { - args []interface{} expected map[string]interface{} + args []interface{} }{ - {nil, map[string]interface{}{}}, - {[]interface{}{}, map[string]interface{}{}}, - {[]interface{}{"foo"}, map[string]interface{}{"foo": ""}}, - {[]interface{}{42}, map[string]interface{}{"42": ""}}, - {[]interface{}{"foo", nil}, map[string]interface{}{"foo": nil}}, - {[]interface{}{"foo", "bar"}, map[string]interface{}{"foo": "bar"}}, - {[]interface{}{"foo", "bar", "baz", true}, map[string]interface{}{ - "foo": "bar", - "baz": true, - }}, + {expected: map[string]interface{}{}}, + { + args: []interface{}{}, + expected: map[string]interface{}{}}, + { + args: []interface{}{"foo"}, + expected: map[string]interface{}{"foo": ""}}, + { + args: []interface{}{42}, + expected: map[string]interface{}{"42": ""}}, + { + args: []interface{}{"foo", nil}, + expected: map[string]interface{}{"foo": nil}}, + { + args: []interface{}{"foo", "bar"}, + expected: map[string]interface{}{"foo": "bar"}}, + { + args: []interface{}{"foo", "bar", "baz", true}, + expected: map[string]interface{}{ + "foo": "bar", + "baz": true, + }}, } for _, d := range testdata { diff --git a/data/data_test.go b/data/data_test.go index 08c49015..9c67ccab 100644 --- a/data/data_test.go +++ b/data/data_test.go @@ -324,18 +324,18 @@ func TestCSVByColumn(t *testing.T) { } testdata := []struct { - args []string out map[string][]string + args []string }{ - {[]string{"first,second,third\n1,2,3\n4,5,6"}, expected}, - {[]string{"first,second,third", "1,2,3\n4,5,6"}, expected}, - {[]string{";", "first;second;third", "1;2;3\n4;5;6"}, expected}, - {[]string{";", "first;second;third\r\n1;2;3\r\n4;5;6"}, expected}, - {[]string{"", "1,2,3\n4,5,6"}, map[string][]string{ + {expected, []string{"first,second,third\n1,2,3\n4,5,6"}}, + {expected, []string{"first,second,third", "1,2,3\n4,5,6"}}, + {expected, []string{";", "first;second;third", "1;2;3\n4;5;6"}}, + {expected, []string{";", "first;second;third\r\n1;2;3\r\n4;5;6"}}, + {map[string][]string{ "A": {"1", "4"}, "B": {"2", "5"}, "C": {"3", "6"}, - }}, + }, []string{"", "1,2,3\n4,5,6"}}, } for _, d := range testdata { out, err := CSVByColumn(d.args...) diff --git a/data/datasource.go b/data/datasource.go index 0f2c44fa..77dc7990 100644 --- a/data/datasource.go +++ b/data/datasource.go @@ -138,9 +138,7 @@ func FromConfig(ctx context.Context, cfg *config.Config) *Data { // Source - a data source type Source struct { - Alias string URL *url.URL - mediaType string fs afero.Fs // used for file: URLs, nil otherwise hc *http.Client // used for http[s]: URLs, nil otherwise vc *vault.Vault // used for vault: URLs, nil otherwise @@ -148,6 +146,8 @@ type Source struct { asmpg awssmpGetter // used for aws+smp:, nil otherwise awsSecretsManager awsSecretsManagerGetter // used for aws+sm, nil otherwise header http.Header // used for http[s]: URLs, nil otherwise + Alias string + mediaType string } func (s *Source) inherit(parent *Source) { diff --git a/data/datasource_aws_sm_test.go b/data/datasource_aws_sm_test.go index 3ed0aa45..c29a9b0b 100644 --- a/data/datasource_aws_sm_test.go +++ b/data/datasource_aws_sm_test.go @@ -45,52 +45,54 @@ func TestAWSSecretsManager_ParseAWSSecretsManagerArgs(t *testing.T) { _, _, err := parseDatasourceURLArgs(mustParseURL("base"), "extra", "too many!") assert.Error(t, err) + tplain := map[string]interface{}{"type": "text/plain"} + data := []struct { - u *url.URL - args []string - expectedParams map[string]interface{} - expectedPath string + eParams map[string]interface{} + u string + ePath string + args string }{ - {mustParseURL("noddy"), nil, nil, "noddy"}, - {mustParseURL("base"), []string{"extra"}, nil, "base/extra"}, - {mustParseURL("/foo/"), []string{"/extra"}, nil, "/foo/extra"}, - {mustParseURL("aws+sm:///foo"), []string{"bar"}, nil, "/foo/bar"}, - {mustParseURL("aws+sm:foo"), nil, nil, "foo"}, - {mustParseURL("aws+sm:foo/bar"), nil, nil, "foo/bar"}, - {mustParseURL("aws+sm:/foo/bar"), nil, nil, "/foo/bar"}, - {mustParseURL("aws+sm:foo"), []string{"baz"}, nil, "foo/baz"}, - {mustParseURL("aws+sm:foo/bar"), []string{"baz"}, nil, "foo/bar/baz"}, - {mustParseURL("aws+sm:/foo/bar"), []string{"baz"}, nil, "/foo/bar/baz"}, - {mustParseURL("aws+sm:///foo"), []string{"dir/"}, nil, "/foo/dir/"}, - {mustParseURL("aws+sm:///foo/"), nil, nil, "/foo/"}, - {mustParseURL("aws+sm:///foo/"), []string{"baz"}, nil, "/foo/baz"}, - - {mustParseURL("aws+sm:foo?type=text/plain"), []string{"baz"}, - map[string]interface{}{"type": "text/plain"}, "foo/baz"}, - {mustParseURL("aws+sm:foo/bar?type=text/plain"), []string{"baz"}, - map[string]interface{}{"type": "text/plain"}, "foo/bar/baz"}, - {mustParseURL("aws+sm:/foo/bar?type=text/plain"), []string{"baz"}, - map[string]interface{}{"type": "text/plain"}, "/foo/bar/baz"}, + {u: "noddy", ePath: "noddy"}, + {u: "base", ePath: "base/extra", args: "extra"}, + {u: "/foo/", ePath: "/foo/extra", args: "/extra"}, + {u: "aws+sm:///foo", ePath: "/foo/bar", args: "bar"}, + {u: "aws+sm:foo", ePath: "foo"}, + {u: "aws+sm:foo/bar", ePath: "foo/bar"}, + {u: "aws+sm:/foo/bar", ePath: "/foo/bar"}, + {u: "aws+sm:foo", ePath: "foo/baz", args: "baz"}, + {u: "aws+sm:foo/bar", ePath: "foo/bar/baz", args: "baz"}, + {u: "aws+sm:/foo/bar", ePath: "/foo/bar/baz", args: "baz"}, + {u: "aws+sm:///foo", ePath: "/foo/dir/", args: "dir/"}, + {u: "aws+sm:///foo/", ePath: "/foo/"}, + {u: "aws+sm:///foo/", ePath: "/foo/baz", args: "baz"}, + {eParams: tplain, u: "aws+sm:foo?type=text/plain", ePath: "foo/baz", args: "baz"}, + {eParams: tplain, u: "aws+sm:foo/bar?type=text/plain", ePath: "foo/bar/baz", args: "baz"}, + {eParams: tplain, u: "aws+sm:/foo/bar?type=text/plain", ePath: "/foo/bar/baz", args: "baz"}, { - mustParseURL("aws+sm:/foo/bar?type=text/plain"), - []string{"baz/qux?type=application/json¶m=quux"}, - map[string]interface{}{ + eParams: map[string]interface{}{ "type": "application/json", "param": "quux", }, - "/foo/bar/baz/qux", + u: "aws+sm:/foo/bar?type=text/plain", + ePath: "/foo/bar/baz/qux", + args: "baz/qux?type=application/json¶m=quux", }, } for _, d := range data { - params, p, err := parseDatasourceURLArgs(d.u, d.args...) + args := []string{d.args} + if d.args == "" { + args = nil + } + params, p, err := parseDatasourceURLArgs(mustParseURL(d.u), args...) assert.NoError(t, err) - if d.expectedParams == nil { + if d.eParams == nil { assert.Empty(t, params) } else { - assert.EqualValues(t, d.expectedParams, params) + assert.EqualValues(t, d.eParams, params) } - assert.Equal(t, d.expectedPath, p) + assert.Equal(t, d.ePath, p) } } diff --git a/data/datasource_awssmp_test.go b/data/datasource_awssmp_test.go index bb0a03c8..3c14e325 100644 --- a/data/datasource_awssmp_test.go +++ b/data/datasource_awssmp_test.go @@ -15,11 +15,11 @@ import ( // DummyParamGetter - test double type DummyParamGetter struct { + err awserr.Error t *testing.T param *ssm.Parameter - params []*ssm.Parameter - err awserr.Error mockGetParameter func(*ssm.GetParameterInput) (*ssm.GetParameterOutput, error) + params []*ssm.Parameter } func (d DummyParamGetter) GetParameterWithContext(ctx context.Context, input *ssm.GetParameterInput, opts ...request.Option) (*ssm.GetParameterOutput, error) { diff --git a/data/datasource_git_test.go b/data/datasource_git_test.go index 73780184..f48393c3 100644 --- a/data/datasource_git_test.go +++ b/data/datasource_git_test.go @@ -100,78 +100,78 @@ func TestParseGitPath(t *testing.T) { data := []struct { url string - args []string + args string repo, path string }{ {"git+https://github.com/hairyhenderson/gomplate//docs-src/content/functions/aws.yml", - nil, + "", "git+https://github.com/hairyhenderson/gomplate", "/docs-src/content/functions/aws.yml"}, {"git+ssh://github.com/hairyhenderson/gomplate.git", - nil, + "", "git+ssh://github.com/hairyhenderson/gomplate.git", "/"}, {"https://github.com", - nil, + "", "https://github.com", "/"}, {"git://example.com/foo//file.txt#someref", - nil, + "", "git://example.com/foo#someref", "/file.txt"}, {"git+file:///home/foo/repo//file.txt#someref", - nil, + "", "git+file:///home/foo/repo#someref", "/file.txt"}, {"git+file:///repo", - nil, + "", "git+file:///repo", "/"}, {"git+file:///foo//foo", - nil, + "", "git+file:///foo", "/foo"}, {"git+file:///foo//foo", - []string{"/bar"}, + "/bar", "git+file:///foo", "/foo/bar"}, {"git+file:///foo//bar", // in this case the // is meaningless - []string{"/baz//qux"}, + "/baz//qux", "git+file:///foo", "/bar/baz/qux"}, {"git+https://example.com/foo", - []string{"/bar"}, + "/bar", "git+https://example.com/foo/bar", "/"}, {"git+https://example.com/foo", - []string{"//bar"}, + "//bar", "git+https://example.com/foo", "/bar"}, {"git+https://example.com//foo", - []string{"/bar"}, + "/bar", "git+https://example.com", "/foo/bar"}, {"git+https://example.com/foo//bar", - []string{"//baz"}, + "//baz", "git+https://example.com/foo", "/bar/baz"}, {"git+https://example.com/foo", - []string{"/bar//baz"}, + "/bar//baz", "git+https://example.com/foo/bar", "/baz"}, {"git+https://example.com/foo?type=t", - []string{"/bar//baz"}, + "/bar//baz", "git+https://example.com/foo/bar?type=t", "/baz"}, {"git+https://example.com/foo#master", - []string{"/bar//baz"}, + "/bar//baz", "git+https://example.com/foo/bar#master", "/baz"}, {"git+https://example.com/foo", - []string{"/bar//baz?type=t"}, + "/bar//baz?type=t", "git+https://example.com/foo/bar?type=t", "/baz"}, {"git+https://example.com/foo", - []string{"/bar//baz#master"}, + "/bar//baz#master", "git+https://example.com/foo/bar#master", "/baz"}, {"git+https://example.com/foo", - []string{"//bar?type=t"}, + "//bar?type=t", "git+https://example.com/foo?type=t", "/bar"}, {"git+https://example.com/foo", - []string{"//bar#master"}, + "//bar#master", "git+https://example.com/foo#master", "/bar"}, {"git+https://example.com/foo?type=t", - []string{"//bar#master"}, + "//bar#master", "git+https://example.com/foo?type=t#master", "/bar"}, {"git+https://example.com/foo?type=t#v1", - []string{"//bar?type=j#v2"}, + "//bar?type=j#v2", "git+https://example.com/foo?type=t&type=j#v2", "/bar"}, } @@ -180,7 +180,11 @@ func TestParseGitPath(t *testing.T) { t.Run(fmt.Sprintf("%d:(%q,%q)==(%q,%q)", i, d.url, d.args, d.repo, d.path), func(t *testing.T) { t.Parallel() u, _ := url.Parse(d.url) - repo, path, err := g.parseGitPath(u, d.args...) + args := []string{d.args} + if d.args == "" { + args = nil + } + repo, path, err := g.parseGitPath(u, args...) assert.NilError(t, err) assert.Equal(t, d.repo, repo.String()) assert.Equal(t, d.path, path) diff --git a/funcs/math_test.go b/funcs/math_test.go index f9e2b20e..7643ac79 100644 --- a/funcs/math_test.go +++ b/funcs/math_test.go @@ -153,17 +153,17 @@ func BenchmarkIsFloat(b *testing.B) { func TestMax(t *testing.T) { m := MathNS() data := []struct { - n []interface{} expected interface{} + n []interface{} }{ - {[]interface{}{nil}, int64(0)}, - {[]interface{}{0}, int64(0)}, - {[]interface{}{"not a number"}, int64(0)}, - {[]interface{}{1}, int64(1)}, - {[]interface{}{-1}, int64(-1)}, - {[]interface{}{-1, 0, 1}, int64(1)}, - {[]interface{}{3.14, 3, 3.9}, 3.9}, - {[]interface{}{"14", "0xff", -5}, int64(255)}, + {int64(0), []interface{}{nil}}, + {int64(0), []interface{}{0}}, + {int64(0), []interface{}{"not a number"}}, + {int64(1), []interface{}{1}}, + {int64(-1), []interface{}{-1}}, + {int64(1), []interface{}{-1, 0, 1}}, + {3.9, []interface{}{3.14, 3, 3.9}}, + {int64(255), []interface{}{"14", "0xff", -5}}, } for _, d := range data { d := d @@ -182,17 +182,17 @@ func TestMax(t *testing.T) { func TestMin(t *testing.T) { m := MathNS() data := []struct { - n []interface{} expected interface{} + n []interface{} }{ - {[]interface{}{nil}, int64(0)}, - {[]interface{}{0}, int64(0)}, - {[]interface{}{"not a number"}, int64(0)}, - {[]interface{}{1}, int64(1)}, - {[]interface{}{-1}, int64(-1)}, - {[]interface{}{-1, 0, 1}, int64(-1)}, - {[]interface{}{3.14, 3, 3.9}, 3.}, - {[]interface{}{"14", "0xff", -5}, int64(-5)}, + {int64(0), []interface{}{nil}}, + {int64(0), []interface{}{0}}, + {int64(0), []interface{}{"not a number"}}, + {int64(1), []interface{}{1}}, + {int64(-1), []interface{}{-1}}, + {int64(-1), []interface{}{-1, 0, 1}}, + {3., []interface{}{3.14, 3, 3.9}}, + {int64(-5), []interface{}{"14", "0xff", -5}}, } for _, d := range data { d := d diff --git a/funcs/strings_test.go b/funcs/strings_test.go index acfa2c3c..0975c6d1 100644 --- a/funcs/strings_test.go +++ b/funcs/strings_test.go @@ -19,13 +19,13 @@ func TestIndent(t *testing.T) { sf := &StringFuncs{} testdata := []struct { - args []interface{} out string + args []interface{} }{ - {[]interface{}{"foo\nbar\nbaz"}, " foo\n bar\n baz"}, - {[]interface{}{" ", "foo\nbar\nbaz"}, " foo\n bar\n baz"}, - {[]interface{}{3, "-", "foo\nbar\nbaz"}, "---foo\n---bar\n---baz"}, - {[]interface{}{3, "foo\nbar\nbaz"}, " foo\n bar\n baz"}, + {" foo\n bar\n baz", []interface{}{"foo\nbar\nbaz"}}, + {" foo\n bar\n baz", []interface{}{" ", "foo\nbar\nbaz"}}, + {"---foo\n---bar\n---baz", []interface{}{3, "-", "foo\nbar\nbaz"}}, + {" foo\n bar\n baz", []interface{}{3, "foo\nbar\nbaz"}}, } for _, d := range testdata { diff --git a/gcp/meta.go b/gcp/meta.go index 9c74d5de..894e9445 100644 --- a/gcp/meta.go +++ b/gcp/meta.go @@ -51,9 +51,9 @@ func GetClientOptions() ClientOptions { // metadata service version 1. type MetaClient struct { client *http.Client + cache map[string]string endpoint string options ClientOptions - cache map[string]string } // NewMetaClient constructs a new MetaClient with the given ClientOptions. If the environment @@ -5,17 +5,17 @@ go 1.16 require ( github.com/Masterminds/goutils v1.1.1 github.com/Shopify/ejson v1.2.2 - github.com/aws/aws-sdk-go v1.38.7 + github.com/aws/aws-sdk-go v1.38.12 github.com/docker/libkv v0.2.2-0.20180912205406-458977154600 github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa github.com/go-git/go-billy/v5 v5.1.0 - github.com/go-git/go-git/v5 v5.2.0 + github.com/go-git/go-git/v5 v5.3.0 github.com/google/uuid v1.2.0 github.com/gosimple/slug v1.9.0 github.com/hairyhenderson/toml v0.3.1-0.20191004034452-2a4f3b6160f2 github.com/hashicorp/consul/api v1.8.1 github.com/hashicorp/go-sockaddr v1.0.2 - github.com/hashicorp/vault/api v1.0.4 + github.com/hashicorp/vault/api v1.1.0 github.com/johannesboyne/gofakes3 v0.0.0-20210217223559-02ffa763be97 github.com/joho/godotenv v1.3.0 github.com/pkg/errors v0.9.1 @@ -23,12 +23,12 @@ require ( github.com/spf13/afero v1.6.0 github.com/spf13/cobra v1.1.3 github.com/stretchr/testify v1.7.0 - github.com/ugorji/go/codec v1.2.4 + github.com/ugorji/go/codec v1.2.5 github.com/zealic/xignore v0.3.3 go.etcd.io/bbolt v1.3.5 gocloud.dev v0.22.0 - golang.org/x/crypto v0.0.0-20210317152858-513c2a44f670 - golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d + golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 + golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b gotest.tools/v3 v3.0.3 @@ -77,9 +77,13 @@ github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/GoogleCloudPlatform/cloudsql-proxy v1.19.1/go.mod h1:+yYmuKqcBVkgRePGpUhTA9OEg0XsnFE96eZ6nJ2yCQM= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= +github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -93,8 +97,9 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.3.0 h1:B7AQgHi8QSEi4uHu7Sbsga+IJDU+CENgjxoo81vDUqU= +github.com/armon/go-metrics v0.3.0/go.mod h1:zXjbSimjXTd7vOpY8B0/2LpvNvDoXBuplAD+gJD3GYs= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= @@ -103,9 +108,10 @@ github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:l github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.17.4/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.25.37/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.36.1/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go v1.38.7 h1:uOu2IrTiNhcSNAjBmA21t48lTx5mgGdcFKamDjXMscA= -github.com/aws/aws-sdk-go v1.38.7/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/aws/aws-sdk-go v1.38.12 h1:khtODkUna3iF53Cg3dCF4e6oWgrAEbZDU4x1aq+G0WY= +github.com/aws/aws-sdk-go v1.38.12/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= @@ -117,6 +123,8 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -170,6 +178,7 @@ github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-asn1-ber/asn1-ber v1.3.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= @@ -177,14 +186,14 @@ github.com/go-git/go-billy/v5 v5.1.0 h1:4pl5BV4o7ZG/lterP4S6WzJ6xr49Ba5ET9ygheTY github.com/go-git/go-billy/v5 v5.1.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12 h1:PbKy9zOy4aAKrJ5pibIRpVO2BXnK1Tlcg+caKI7Ox5M= github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= -github.com/go-git/go-git/v5 v5.2.0 h1:YPBLG/3UK1we1ohRkncLjaXWLW+HKp5QNM/jTli2JgI= -github.com/go-git/go-git/v5 v5.2.0/go.mod h1:kh02eMX+wdqqxgNMEyq8YgwlIOsDOa9homkUq1PoTMs= +github.com/go-git/go-git/v5 v5.3.0 h1:8WKMtJR2j8RntEXR/uvTKagfEt4GYlwQ7mntE4+0GWc= +github.com/go-git/go-git/v5 v5.3.0/go.mod h1:xdX4bWJ48aOrdhnl2XqHYstHbbp6+LFS4r4X+lNVprw= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= +github.com/go-ldap/ldap/v3 v3.1.3/go.mod h1:3rbOH3jRS2u6jg2rJnKAMLE/xQyCKIveG2Sa/Cohzb8= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= @@ -203,6 +212,8 @@ github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GO github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw= +github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= @@ -311,21 +322,22 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= -github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.12.0 h1:d4QkX8FRTYaKaCZBoXYY8zJX2BXjWxurN/GA2tkrmZM= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-kms-wrapping/entropy v0.1.0/go.mod h1:d1g9WGtAunDNpek8jUIEJnBlbgKS1N2Q61QkHiZyR1g= github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= -github.com/hashicorp/go-retryablehttp v0.5.4 h1:1BZvpawXoJCWX6pNtow9+rpEj+3itIlutiqnntI6jOE= -github.com/hashicorp/go-retryablehttp v0.5.4/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-retryablehttp v0.6.6 h1:HJunrbHTDDbBb/ay4kxa1n+dLmttUlnP3V9oNE4hmsM= +github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= @@ -333,8 +345,9 @@ github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0S github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -351,23 +364,22 @@ github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOn github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.5 h1:EBWvyu9tcRszt3Bxp3KNssBMP1KuHWyO51lz9+786iM= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= -github.com/hashicorp/vault/api v1.0.4 h1:j08Or/wryXT4AcHj1oCbMd7IijXcKzYUGw59LGu9onU= -github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q= -github.com/hashicorp/vault/sdk v0.1.13 h1:mOEPeOhT7jl0J4AMl1E705+BcmeRs1VmKNb9F0sMLy8= -github.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M= +github.com/hashicorp/vault/api v1.1.0 h1:QcxC7FuqEl0sZaIjcXB/kNEeBa0DH5z57qbWBvZwLC4= +github.com/hashicorp/vault/api v1.1.0/go.mod h1:R3Umvhlxi2TN7Ex2hzOowyeNb+SfbVWI973N+ctaFMk= +github.com/hashicorp/vault/sdk v0.1.14-0.20200519221838-e0cfd64bc267 h1:e1ok06zGrWJW91rzRroyl5nRNqraaBe4d5hiKcVZuHM= +github.com/hashicorp/vault/sdk v0.1.14-0.20200519221838-e0cfd64bc267/go.mod h1:WX57W2PwkrOPQ6rVQk+dy5/htHIaB4aBM70EwKThu10= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg= -github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= +github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= @@ -388,8 +400,8 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd h1:Coekwdh0v2wtGp9Gmz1Ze3eVRAWJMLokvN3QjdzCHLY= -github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= +github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -400,6 +412,8 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -440,6 +454,7 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4 github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.0 h1:7ks8ZkOP5/ujthUsT07rNv+nkLXCQWKNHuwzOAesEks= github.com/mitchellh/mapstructure v1.4.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -451,7 +466,6 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -477,13 +491,16 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be h1:ta7tUOvsPHVHGom5hKW5VXNc2xZIkfCKP8iaqOyYtUQ= @@ -508,6 +525,7 @@ github.com/shabbyrobe/gocovmerge v0.0.0-20180507124511-f6ea450bfb63 h1:J6qvD6rbm github.com/shabbyrobe/gocovmerge v0.0.0-20180507124511-f6ea450bfb63/go.mod h1:n+VKSARF5y/tS9XFSP7vWDfS+GUC5vs/YT7M5XDTUEM= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= @@ -542,15 +560,16 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go v1.2.4 h1:cTciPbZ/VSOzCLKclmssnfQ/jyoVyOcJ3aoJyUV1Urc= -github.com/ugorji/go v1.2.4/go.mod h1:EuaSCk8iZMdIspsu6HXH7X2UGKw1ezO4wCfGszGmmo4= +github.com/ugorji/go v1.2.5 h1:NozRHfUeEta89taVkyfsDVSy2f7v89Frft4pjnWuGuc= +github.com/ugorji/go v1.2.5/go.mod h1:gat2tIT8KJG8TVI8yv77nEO/KYT6dV7JE1gfUa8Xuls= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.4 h1:C5VurWRRCKjuENsbM6GYVw8W++WVW9rSxoACKIvxzz8= -github.com/ugorji/go/codec v1.2.4/go.mod h1:bWBu1+kIRWcF8uMklKaJrR6fTWQOwAlrIzX22pHwryA= +github.com/ugorji/go/codec v1.2.5 h1:8WobZKAk18Msm2CothY2jnztY56YVY8kF1oQrj21iis= +github.com/ugorji/go/codec v1.2.5/go.mod h1:QPxoTbPKSEAlAHPYt02++xp/en9B/wUdwFCz+hj5caA= github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70= -github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= +github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= +github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -579,20 +598,20 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210317152858-513c2a44f670 h1:gzMM0EjIYiRmJI3+jBdFuoynZlpxa2JQZsolKu09BXo= -golang.org/x/crypto v0.0.0-20210317152858-513c2a44f670/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -659,6 +678,7 @@ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -667,8 +687,9 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210326060303-6b1517762897 h1:KrsHThm5nFk34YtATK1LsThyGhGbGe1olrte/HInHvs= +golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -696,7 +717,6 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190310054646-10058d7d4faa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -708,6 +728,7 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -741,8 +762,10 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d h1:jbzgAvDZn8aEnytae+4ou0J0GwFZoHR0hOrTg4qH8GA= -golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 h1:F5Gozwx4I1xtr/sr/8CFbb57iKi3297KFs0QDbGN60A= +golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 h1:EC6+IGYTjPpRfv9a2b/6Puw0W+hLtAhkV1tPsXhutqs= @@ -750,7 +773,6 @@ golang.org/x/term v0.0.0-20210317153231-de623e64d2a6/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= @@ -758,6 +780,7 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -859,7 +882,6 @@ google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6 google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -930,20 +952,20 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= -gopkg.in/square/go-jose.v2 v2.3.1 h1:SK5KegNXmKmqE342YYN2qPHEnUYeoMiXXl1poUlI+o4= -gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w= +gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= @@ -952,6 +974,7 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/gomplate.go b/gomplate.go index 3cfdb581..a036b392 100644 --- a/gomplate.go +++ b/gomplate.go @@ -23,12 +23,12 @@ import ( // gomplate - type gomplate struct { + tmplctx interface{} funcMap template.FuncMap - leftDelim string - rightDelim string nestedTemplates templateAliases rootTemplate *template.Template - tmplctx interface{} + + leftDelim, rightDelim string } // runTemplate - diff --git a/gomplate_test.go b/gomplate_test.go index 797eb87e..2ea1d241 100644 --- a/gomplate_test.go +++ b/gomplate_test.go @@ -172,29 +172,26 @@ func TestParseTemplateArg(t *testing.T) { afero.WriteFile(fs, "dir/foo.t", []byte("hi"), 0600) afero.WriteFile(fs, "dir/bar.t", []byte("hi"), 0600) + err := parseTemplateArg("bogus.t", templateAliases{}) + assert.Error(t, err) + testdata := []struct { - arg string expected map[string]string - err bool + arg string }{ - {"bogus.t", nil, true}, - {"foo.t", map[string]string{"foo.t": "foo.t"}, false}, - {"foo=foo.t", map[string]string{"foo": "foo.t"}, false}, - {"dir/foo.t", map[string]string{"dir/foo.t": "dir/foo.t"}, false}, - {"foo=dir/foo.t", map[string]string{"foo": "dir/foo.t"}, false}, - {"dir/", map[string]string{"dir/foo.t": "dir/foo.t", "dir/bar.t": "dir/bar.t"}, false}, - {"t=dir/", map[string]string{"t/foo.t": "dir/foo.t", "t/bar.t": "dir/bar.t"}, false}, + {map[string]string{"foo.t": "foo.t"}, "foo.t"}, + {map[string]string{"foo": "foo.t"}, "foo=foo.t"}, + {map[string]string{"dir/foo.t": "dir/foo.t"}, "dir/foo.t"}, + {map[string]string{"foo": "dir/foo.t"}, "foo=dir/foo.t"}, + {map[string]string{"dir/foo.t": "dir/foo.t", "dir/bar.t": "dir/bar.t"}, "dir/"}, + {map[string]string{"t/foo.t": "dir/foo.t", "t/bar.t": "dir/bar.t"}, "t=dir/"}, } for _, d := range testdata { nested := templateAliases{} err := parseTemplateArg(d.arg, nested) - if d.err { - assert.Error(t, err, d.arg) - } else { - assert.NoError(t, err, d.arg) - assert.Equal(t, templateAliases(d.expected), nested, d.arg) - } + assert.NoError(t, err, d.arg) + assert.Equal(t, templateAliases(d.expected), nested, d.arg) } } diff --git a/internal/cmd/config_test.go b/internal/cmd/config_test.go index 9885ef87..aa7ff753 100644 --- a/internal/cmd/config_test.go +++ b/internal/cmd/config_test.go @@ -197,102 +197,85 @@ func TestPickConfigFile(t *testing.T) { } func TestApplyEnvVars(t *testing.T) { + os.Setenv("GOMPLATE_PLUGIN_TIMEOUT", "bogus") + _, err := applyEnvVars(context.Background(), &config.Config{}) + os.Unsetenv("GOMPLATE_PLUGIN_TIMEOUT") + assert.Error(t, err) + data := []struct { + input, expected *config.Config env string value string - shouldErr bool - input, expected *config.Config }{ { - "GOMPLATE_PLUGIN_TIMEOUT", "bogus", - true, - &config.Config{}, nil, - }, - { - "GOMPLATE_PLUGIN_TIMEOUT", "bogus", - false, &config.Config{PluginTimeout: 2 * time.Second}, &config.Config{PluginTimeout: 2 * time.Second}, + "GOMPLATE_PLUGIN_TIMEOUT", "bogus", }, { - "GOMPLATE_PLUGIN_TIMEOUT", "2s", - false, &config.Config{}, &config.Config{PluginTimeout: 2 * time.Second}, + "GOMPLATE_PLUGIN_TIMEOUT", "2s", }, { - "GOMPLATE_PLUGIN_TIMEOUT", "2s", - false, &config.Config{PluginTimeout: 100 * time.Millisecond}, &config.Config{PluginTimeout: 100 * time.Millisecond}, + "GOMPLATE_PLUGIN_TIMEOUT", "2s", }, - { - "GOMPLATE_SUPPRESS_EMPTY", "bogus", - false, &config.Config{}, &config.Config{SuppressEmpty: false}, + "GOMPLATE_SUPPRESS_EMPTY", "bogus", }, { - "GOMPLATE_SUPPRESS_EMPTY", "true", - false, &config.Config{}, &config.Config{SuppressEmpty: true}, + "GOMPLATE_SUPPRESS_EMPTY", "true", }, { - "GOMPLATE_SUPPRESS_EMPTY", "false", - false, &config.Config{SuppressEmpty: true}, &config.Config{SuppressEmpty: true}, + "GOMPLATE_SUPPRESS_EMPTY", "false", }, - { - "GOMPLATE_EXPERIMENTAL", "bogus", - false, &config.Config{}, &config.Config{Experimental: false}, + "GOMPLATE_EXPERIMENTAL", "bogus", }, { - "GOMPLATE_EXPERIMENTAL", "true", - false, &config.Config{}, &config.Config{Experimental: true}, + "GOMPLATE_EXPERIMENTAL", "true", }, { - "GOMPLATE_EXPERIMENTAL", "false", - false, &config.Config{Experimental: true}, &config.Config{Experimental: true}, + "GOMPLATE_EXPERIMENTAL", "false", }, { - "GOMPLATE_LEFT_DELIM", "--", - false, &config.Config{}, &config.Config{LDelim: "--"}, + "GOMPLATE_LEFT_DELIM", "--", }, { - "GOMPLATE_LEFT_DELIM", "--", - false, &config.Config{LDelim: "{{"}, &config.Config{LDelim: "{{"}, + "GOMPLATE_LEFT_DELIM", "--", }, { - "GOMPLATE_RIGHT_DELIM", ")>", - false, &config.Config{}, &config.Config{RDelim: ")>"}, + "GOMPLATE_RIGHT_DELIM", ")>", }, { - "GOMPLATE_RIGHT_DELIM", ")>", - false, &config.Config{RDelim: "}}"}, &config.Config{RDelim: "}}"}, + "GOMPLATE_RIGHT_DELIM", ")>", }, { - "GOMPLATE_RIGHT_DELIM", "", - false, &config.Config{RDelim: "}}"}, &config.Config{RDelim: "}}"}, + "GOMPLATE_RIGHT_DELIM", "", }, } @@ -303,12 +286,8 @@ func TestApplyEnvVars(t *testing.T) { actual, err := applyEnvVars(context.Background(), d.input) os.Unsetenv(d.env) - if d.shouldErr { - assert.Error(t, err) - } else { - assert.NoError(t, err) - assert.EqualValues(t, d.expected, actual) - } + assert.NoError(t, err) + assert.EqualValues(t, d.expected, actual) }) } } diff --git a/internal/config/configfile.go b/internal/config/configfile.go index ac6b61b9..3858f85e 100644 --- a/internal/config/configfile.go +++ b/internal/config/configfile.go @@ -32,39 +32,43 @@ func Parse(in io.Reader) (*Config, error) { // Config - configures the gomplate execution type Config struct { + Stdin io.Reader `yaml:"-"` + Stdout io.Writer `yaml:"-"` + Stderr io.Writer `yaml:"-"` + + // internal use only, can't be injected in YAML + PostExecInput io.Reader `yaml:"-"` + Input string `yaml:"in,omitempty"` - InputFiles []string `yaml:"inputFiles,omitempty,flow"` InputDir string `yaml:"inputDir,omitempty"` + InputFiles []string `yaml:"inputFiles,omitempty,flow"` ExcludeGlob []string `yaml:"excludes,omitempty"` - OutputFiles []string `yaml:"outputFiles,omitempty,flow"` + OutputDir string `yaml:"outputDir,omitempty"` OutputMap string `yaml:"outputMap,omitempty"` + OutputFiles []string `yaml:"outputFiles,omitempty,flow"` + OutMode string `yaml:"chmod,omitempty"` - Experimental bool `yaml:"experimental,omitempty"` + LDelim string `yaml:"leftDelim,omitempty"` + RDelim string `yaml:"rightDelim,omitempty"` - SuppressEmpty bool `yaml:"suppressEmpty,omitempty"` - ExecPipe bool `yaml:"execPipe,omitempty"` - PostExec []string `yaml:"postExec,omitempty,flow"` + PostExec []string `yaml:"postExec,omitempty,flow"` - OutMode string `yaml:"chmod,omitempty"` - LDelim string `yaml:"leftDelim,omitempty"` - RDelim string `yaml:"rightDelim,omitempty"` - DataSources map[string]DataSource `yaml:"datasources,omitempty"` - Context map[string]DataSource `yaml:"context,omitempty"` - Plugins map[string]string `yaml:"plugins,omitempty"` - PluginTimeout time.Duration `yaml:"pluginTimeout,omitempty"` - Templates []string `yaml:"templates,omitempty"` + DataSources map[string]DataSource `yaml:"datasources,omitempty"` + Context map[string]DataSource `yaml:"context,omitempty"` + Plugins map[string]string `yaml:"plugins,omitempty"` // Extra HTTP headers not attached to pre-defined datsources. Potentially // used by datasources defined in the template. ExtraHeaders map[string]http.Header `yaml:"-"` - // internal use only, can't be injected in YAML - PostExecInput io.Reader `yaml:"-"` + Templates []string `yaml:"templates,omitempty"` - Stdin io.Reader `yaml:"-"` - Stdout io.Writer `yaml:"-"` - Stderr io.Writer `yaml:"-"` + PluginTimeout time.Duration `yaml:"pluginTimeout,omitempty"` + + ExecPipe bool `yaml:"execPipe,omitempty"` + SuppressEmpty bool `yaml:"suppressEmpty,omitempty"` + Experimental bool `yaml:"experimental,omitempty"` } var cfgContextKey = struct{}{} @@ -111,8 +115,8 @@ type DataSource struct { // well supported, and anyway we need to do some extra parsing func (d *DataSource) UnmarshalYAML(value *yaml.Node) error { type raw struct { - URL string Header http.Header + URL string } r := raw{} err := value.Decode(&r) @@ -134,8 +138,8 @@ func (d *DataSource) UnmarshalYAML(value *yaml.Node) error { // well supported, and anyway we need to do some extra parsing func (d DataSource) MarshalYAML() (interface{}, error) { type raw struct { - URL string Header http.Header + URL string } r := raw{ URL: d.URL.String(), diff --git a/internal/iohelpers/readers.go b/internal/iohelpers/readers.go index 277d7ab9..090a44a0 100644 --- a/internal/iohelpers/readers.go +++ b/internal/iohelpers/readers.go @@ -15,11 +15,11 @@ func LazyReadCloser(open func() (io.ReadCloser, error)) io.ReadCloser { } type lazyReadCloser struct { - opened sync.Once - r io.ReadCloser + r io.ReadCloser // caches the error that came from open(), if any openErr error open func() (io.ReadCloser, error) + opened sync.Once } var _ io.ReadCloser = (*lazyReadCloser)(nil) diff --git a/internal/iohelpers/writers.go b/internal/iohelpers/writers.go index 59e7def7..5030d275 100644 --- a/internal/iohelpers/writers.go +++ b/internal/iohelpers/writers.go @@ -181,11 +181,11 @@ func LazyWriteCloser(open func() (io.WriteCloser, error)) io.WriteCloser { } type lazyWriteCloser struct { - opened sync.Once - w io.WriteCloser + w io.WriteCloser // caches the error that came from open(), if any openErr error open func() (io.WriteCloser, error) + opened sync.Once } var _ io.WriteCloser = (*lazyWriteCloser)(nil) diff --git a/internal/tests/integration/basic_test.go b/internal/tests/integration/basic_test.go index e7cb7364..243bef4b 100644 --- a/internal/tests/integration/basic_test.go +++ b/internal/tests/integration/basic_test.go @@ -73,11 +73,11 @@ func TestBasic_RoutesInputsToProperOutputs(t *testing.T) { testdata := []struct { path string - mode os.FileMode content string + mode os.FileMode }{ - {oneOut, 0640, "hi\n"}, - {twoOut, 0644, "hello\n"}, + {oneOut, "hi\n", 0640}, + {twoOut, "hello\n", 0644}, } for _, v := range testdata { info, err := os.Stat(v.path) @@ -92,32 +92,32 @@ func TestBasic_RoutesInputsToProperOutputs(t *testing.T) { func TestBasic_FlagRules(t *testing.T) { testdata := []struct { - args []string errmsg string + args []string }{ { - []string{"-f", "-", "-i", "HELLO WORLD"}, "only one of these options is supported at a time: 'in', 'inputFiles'", + []string{"-f", "-", "-i", "HELLO WORLD"}, }, { - []string{"--output-dir", "."}, "these options must be set together: 'outputDir', 'inputDir'", + []string{"--output-dir", "."}, }, { - []string{"--input-dir", ".", "--in", "param"}, "only one of these options is supported at a time: 'in', 'inputDir'", + []string{"--input-dir", ".", "--in", "param"}, }, { - []string{"--input-dir", ".", "--file", "input.txt"}, "only one of these options is supported at a time: 'inputFiles', 'inputDir'", + []string{"--input-dir", ".", "--file", "input.txt"}, }, { - []string{"--output-dir", ".", "--out", "param"}, "only one of these options is supported at a time: 'outputFiles', 'outputDir'", + []string{"--output-dir", ".", "--out", "param"}, }, { - []string{"--output-map", ".", "--out", "param"}, "only one of these options is supported at a time: 'outputFiles', 'outputMap'", + []string{"--output-map", ".", "--out", "param"}, }, } @@ -194,11 +194,11 @@ func TestBasic_RoutesInputsToProperOutputsWithChmod(t *testing.T) { testdata := []struct { path string - mode os.FileMode content string + mode os.FileMode }{ - {oneOut, 0600, "hi\n"}, - {twoOut, 0600, "hello\n"}, + {oneOut, "hi\n", 0600}, + {twoOut, "hello\n", 0600}, } for _, v := range testdata { info, err := os.Stat(v.path) @@ -223,10 +223,10 @@ func TestBasic_OverridesOutputModeWithChmod(t *testing.T) { testdata := []struct { path string - mode os.FileMode content string + mode os.FileMode }{ - {out, 0600, "hi\n"}, + {out, "hi\n", 0600}, } for _, v := range testdata { info, err := os.Stat(v.path) diff --git a/internal/tests/integration/inputdir_test.go b/internal/tests/integration/inputdir_test.go index dc0e7975..e281fb07 100644 --- a/internal/tests/integration/inputdir_test.go +++ b/internal/tests/integration/inputdir_test.go @@ -57,13 +57,13 @@ func TestInputDir_InputDir(t *testing.T) { testdata := []struct { path string - mode os.FileMode content string + mode os.FileMode }{ - {tmpDir.Join("out", "eins.txt"), 0644, "eins"}, - {tmpDir.Join("out", "inner", "deux.txt"), 0444, "deux"}, - {tmpDir.Join("out", "drei.sh"), 0755, `#!/bin/sh\necho "hello world"\n`}, - {tmpDir.Join("out", "vier.txt"), 0544, "deux * deux"}, + {tmpDir.Join("out", "eins.txt"), "eins", 0644}, + {tmpDir.Join("out", "inner", "deux.txt"), "deux", 0444}, + {tmpDir.Join("out", "drei.sh"), `#!/bin/sh\necho "hello world"\n`, 0755}, + {tmpDir.Join("out", "vier.txt"), "deux * deux", 0544}, } for _, v := range testdata { info, err := os.Stat(v.path) @@ -96,13 +96,13 @@ func TestInputDir_InputDirWithModeOverride(t *testing.T) { testdata := []struct { path string - mode os.FileMode content string + mode os.FileMode }{ - {tmpDir.Join("out", "eins.txt"), 0601, "eins"}, - {tmpDir.Join("out", "inner", "deux.txt"), 0601, "deux"}, - {tmpDir.Join("out", "drei.sh"), 0601, `#!/bin/sh\necho "hello world"\n`}, - {tmpDir.Join("out", "vier.txt"), 0601, "deux * deux"}, + {tmpDir.Join("out", "eins.txt"), "eins", 0601}, + {tmpDir.Join("out", "inner", "deux.txt"), "deux", 0601}, + {tmpDir.Join("out", "drei.sh"), `#!/bin/sh\necho "hello world"\n`, 0601}, + {tmpDir.Join("out", "vier.txt"), "deux * deux", 0601}, } for _, v := range testdata { info, err := os.Stat(v.path) @@ -134,13 +134,13 @@ func TestInputDir_OutputMapInline(t *testing.T) { testdata := []struct { path string - mode os.FileMode content string + mode os.FileMode }{ - {tmpDir.Join("OUT", "EINS.TXT"), 0644, "eins"}, - {tmpDir.Join("OUT", "INNER", "DEUX.TXT"), 0444, "deux"}, - {tmpDir.Join("OUT", "DREI.SH"), 0755, `#!/bin/sh\necho "hello world"\n`}, - {tmpDir.Join("OUT", "VIER.TXT"), 0544, "deux * deux"}, + {tmpDir.Join("OUT", "EINS.TXT"), "eins", 0644}, + {tmpDir.Join("OUT", "INNER", "DEUX.TXT"), "deux", 0444}, + {tmpDir.Join("OUT", "DREI.SH"), `#!/bin/sh\necho "hello world"\n`, 0755}, + {tmpDir.Join("OUT", "VIER.TXT"), "deux * deux", 0544}, } for _, v := range testdata { info, err := os.Stat(v.path) @@ -174,13 +174,13 @@ func TestInputDir_OutputMapExternal(t *testing.T) { testdata := []struct { path string - mode os.FileMode content string + mode os.FileMode }{ - {tmpDir.Join("out", "uno.out"), 0644, "eins"}, - {tmpDir.Join("out", "inner", "dos.out"), 0444, "deux"}, - {tmpDir.Join("out", "tres.out"), 0755, `#!/bin/sh\necho "hello world"\n`}, - {tmpDir.Join("out", "quatro.out"), 0544, "deux * deux"}, + {tmpDir.Join("out", "uno.out"), "eins", 0644}, + {tmpDir.Join("out", "inner", "dos.out"), "deux", 0444}, + {tmpDir.Join("out", "tres.out"), `#!/bin/sh\necho "hello world"\n`, 0755}, + {tmpDir.Join("out", "quatro.out"), "deux * deux", 0544}, } for _, v := range testdata { info, err := os.Stat(v.path) @@ -249,12 +249,12 @@ func TestInputDir_InputDirCwd(t *testing.T) { testdata := []struct { path string - mode os.FileMode content string + mode os.FileMode }{ - {tmpDir.Join("in", "eins.out"), 0644, "eins"}, - {tmpDir.Join("in", "inner", "deux.out"), 0444, "deux"}, - {tmpDir.Join("in", "vier.out"), 0544, "deux * deux"}, + {tmpDir.Join("in", "eins.out"), "eins", 0644}, + {tmpDir.Join("in", "inner", "deux.out"), "deux", 0444}, + {tmpDir.Join("in", "vier.out"), "deux * deux", 0544}, } for _, v := range testdata { info, err := os.Stat(v.path) diff --git a/internal/tests/integration/integration_test.go b/internal/tests/integration/integration_test.go index d273cb3d..34e6dd4d 100644 --- a/internal/tests/integration/integration_test.go +++ b/internal/tests/integration/integration_test.go @@ -110,9 +110,9 @@ func waitForURL(t *testing.T, url string) error { } type vaultClient struct { + vc *vaultapi.Client addr string rootToken string - vc *vaultapi.Client } func createVaultClient(addr string, rootToken string) (*vaultClient, error) { @@ -123,9 +123,9 @@ func createVaultClient(addr string, rootToken string) (*vaultClient, error) { return nil, err } v := &vaultClient{ + vc: client, addr: addr, rootToken: rootToken, - vc: client, } client.SetToken(rootToken) return v, nil @@ -231,8 +231,8 @@ func (c *command) runCompiled(bin string) (o, e string, err error) { cmd.Stdin = strings.NewReader(c.stdin) cmd.Env = os.Environ() cmd.Env = append(cmd.Env, "GOMPLATE_LOG_FORMAT=simple") - for k, v := range c.env { - cmd.Env = append(cmd.Env, k+"="+v) + for _, k := range c.envK { + cmd.Env = append(cmd.Env, k+"="+c.env[k]) } result := icmd.RunCmd(cmd) diff --git a/libkv/libkv_test.go b/libkv/libkv_test.go index 747a1567..7a5a909e 100644 --- a/libkv/libkv_test.go +++ b/libkv/libkv_test.go @@ -25,8 +25,8 @@ func TestRead(t *testing.T) { } type FakeStore struct { - data []*store.KVPair err error + data []*store.KVPair } func (s *FakeStore) Put(key string, value []byte, options *store.WriteOptions) error { @@ -9,12 +9,16 @@ var Metrics *MetricsType // MetricsType - Warning: experimental! This may change in breaking ways without warning. // This is not subject to any semantic versioning guarantees! type MetricsType struct { - TemplatesGathered int - TemplatesProcessed int - Errors int - GatherDuration time.Duration // time it took to gather templates - TotalRenderDuration time.Duration // time it took to render all templates - RenderDuration map[string]time.Duration // times for rendering each template + // times for rendering each template + RenderDuration map[string]time.Duration + // time it took to gather templates + GatherDuration time.Duration + // time it took to render all templates + TotalRenderDuration time.Duration + + TemplatesGathered int + TemplatesProcessed int + Errors int } func newMetrics() *MetricsType { @@ -36,10 +36,10 @@ func bindPlugins(ctx context.Context, cfg *config.Config, funcMap template.FuncM // plugin represents a custom function that binds to an external process to be executed type plugin struct { - name, path string - timeout time.Duration ctx context.Context stderr io.Writer + name, path string + timeout time.Duration } // builds a command that's appropriate for running scripts diff --git a/regexp/regexp_test.go b/regexp/regexp_test.go index 1a6bb858..b8322156 100644 --- a/regexp/regexp_test.go +++ b/regexp/regexp_test.go @@ -21,14 +21,14 @@ func TestFindAll(t *testing.T) { testdata := []struct { re string - n int in string expected []string + n int }{ - {`[a-z]+`, -1, `foo bar baz`, []string{"foo", "bar", "baz"}}, - {`[a-z]+`, 0, `foo bar baz`, nil}, - {`[a-z]+`, 2, `foo bar baz`, []string{"foo", "bar"}}, - {`[a-z]+`, 14, `foo bar baz`, []string{"foo", "bar", "baz"}}, + {`[a-z]+`, `foo bar baz`, []string{"foo", "bar", "baz"}, -1}, + {`[a-z]+`, `foo bar baz`, nil, 0}, + {`[a-z]+`, `foo bar baz`, []string{"foo", "bar"}, 2}, + {`[a-z]+`, `foo bar baz`, []string{"foo", "bar", "baz"}, 14}, } for _, d := range testdata { @@ -91,14 +91,14 @@ func TestSplit(t *testing.T) { testdata := []struct { re string - n int in string expected []string + n int }{ - {`\s+`, -1, "foo bar baz\tqux", []string{"foo", "bar", "baz", "qux"}}, - {`,`, 0, `foo bar baz`, nil}, - {` `, 2, `foo bar baz`, []string{"foo", "bar baz"}}, - {`[\s,.]`, 14, `foo bar.baz,qux`, []string{"foo", "bar", "baz", "qux"}}, + {`\s+`, "foo bar baz\tqux", []string{"foo", "bar", "baz", "qux"}, -1}, + {`,`, `foo bar baz`, nil, 0}, + {` `, `foo bar baz`, []string{"foo", "bar baz"}, 2}, + {`[\s,.]`, `foo bar.baz,qux`, []string{"foo", "bar", "baz", "qux"}, 14}, } for _, d := range testdata { diff --git a/strings/strings.go b/strings/strings.go index a7b17a68..fd8e6000 100644 --- a/strings/strings.go +++ b/strings/strings.go @@ -92,11 +92,11 @@ func CamelCase(in string) string { // WordWrapOpts defines the options to apply to the WordWrap function type WordWrapOpts struct { - // The desired maximum line length in characters (defaults to 80) - Width uint - // Line-break sequence to insert (defaults to "\n") LBSeq string + + // The desired maximum line length in characters (defaults to 80) + Width uint } // applies default options |
