diff options
author | appilon <apilon@hashicorp.com> | 2019-02-27 16:43:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-27 16:43:31 -0500 |
commit | 844b5a68d8af4791755b8f0ad293cc99f5959183 (patch) | |
tree | 255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/github.com/zclconf/go-cty/cty/gocty/helpers.go | |
parent | 303b299eeb6b06e939e35905e4b34cb410dd9dc3 (diff) | |
parent | 15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (diff) | |
download | terraform-provider-statuscake-844b5a68d8af4791755b8f0ad293cc99f5959183.tar.gz terraform-provider-statuscake-844b5a68d8af4791755b8f0ad293cc99f5959183.tar.zst terraform-provider-statuscake-844b5a68d8af4791755b8f0ad293cc99f5959183.zip |
Merge pull request #27 from terraform-providers/go-modules-2019-02-22
[MODULES] Switch to Go Modules
Diffstat (limited to 'vendor/github.com/zclconf/go-cty/cty/gocty/helpers.go')
-rw-r--r-- | vendor/github.com/zclconf/go-cty/cty/gocty/helpers.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/github.com/zclconf/go-cty/cty/gocty/helpers.go b/vendor/github.com/zclconf/go-cty/cty/gocty/helpers.go new file mode 100644 index 0000000..94ffd2f --- /dev/null +++ b/vendor/github.com/zclconf/go-cty/cty/gocty/helpers.go | |||
@@ -0,0 +1,43 @@ | |||
1 | package gocty | ||
2 | |||
3 | import ( | ||
4 | "math/big" | ||
5 | "reflect" | ||
6 | |||
7 | "github.com/zclconf/go-cty/cty" | ||
8 | "github.com/zclconf/go-cty/cty/set" | ||
9 | ) | ||
10 | |||
11 | var valueType = reflect.TypeOf(cty.Value{}) | ||
12 | var typeType = reflect.TypeOf(cty.Type{}) | ||
13 | |||
14 | var setType = reflect.TypeOf(set.Set{}) | ||
15 | |||
16 | var bigFloatType = reflect.TypeOf(big.Float{}) | ||
17 | var bigIntType = reflect.TypeOf(big.Int{}) | ||
18 | |||
19 | var emptyInterfaceType = reflect.TypeOf(interface{}(nil)) | ||
20 | |||
21 | var stringType = reflect.TypeOf("") | ||
22 | |||
23 | // structTagIndices interrogates the fields of the given type (which must | ||
24 | // be a struct type, or we'll panic) and returns a map from the cty | ||
25 | // attribute names declared via struct tags to the indices of the | ||
26 | // fields holding those tags. | ||
27 | // | ||
28 | // This function will panic if two fields within the struct are tagged with | ||
29 | // the same cty attribute name. | ||
30 | func structTagIndices(st reflect.Type) map[string]int { | ||
31 | ct := st.NumField() | ||
32 | ret := make(map[string]int, ct) | ||
33 | |||
34 | for i := 0; i < ct; i++ { | ||
35 | field := st.Field(i) | ||
36 | attrName := field.Tag.Get("cty") | ||
37 | if attrName != "" { | ||
38 | ret[attrName] = i | ||
39 | } | ||
40 | } | ||
41 | |||
42 | return ret | ||
43 | } | ||