aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/zclconf/go-cty/cty
diff options
context:
space:
mode:
authorAlexandre Garand <alexandre.garand@fretlink.com>2019-08-09 15:59:15 +0200
committerAlexandre Garand <alexandre.garand@fretlink.com>2019-08-09 16:39:21 +0200
commit863486a6b71ed0e562a3965bed56465d007b1418 (patch)
treee93f6a687695af86d54237ec9f575d4ef104222d /vendor/github.com/zclconf/go-cty/cty
parent49c1c7b4dc69ffb9ab52330e6dc52ccdd6351087 (diff)
downloadterraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.tar.gz
terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.tar.zst
terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.zip
update vendor and go.modadd_contact_groups
Diffstat (limited to 'vendor/github.com/zclconf/go-cty/cty')
-rw-r--r--vendor/github.com/zclconf/go-cty/cty/path.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/vendor/github.com/zclconf/go-cty/cty/path.go b/vendor/github.com/zclconf/go-cty/cty/path.go
index bf1a7c1..b314449 100644
--- a/vendor/github.com/zclconf/go-cty/cty/path.go
+++ b/vendor/github.com/zclconf/go-cty/cty/path.go
@@ -71,6 +71,48 @@ func (p Path) GetAttr(name string) Path {
71 return ret 71 return ret
72} 72}
73 73
74// Equals compares 2 Paths for exact equality.
75func (p Path) Equals(other Path) bool {
76 if len(p) != len(other) {
77 return false
78 }
79
80 for i := range p {
81 pv := p[i]
82 switch pv := pv.(type) {
83 case GetAttrStep:
84 ov, ok := other[i].(GetAttrStep)
85 if !ok || pv != ov {
86 return false
87 }
88 case IndexStep:
89 ov, ok := other[i].(IndexStep)
90 if !ok {
91 return false
92 }
93
94 if !pv.Key.RawEquals(ov.Key) {
95 return false
96 }
97 default:
98 // Any invalid steps default to evaluating false.
99 return false
100 }
101 }
102
103 return true
104
105}
106
107// HasPrefix determines if the path p contains the provided prefix.
108func (p Path) HasPrefix(prefix Path) bool {
109 if len(prefix) > len(p) {
110 return false
111 }
112
113 return p[:len(prefix)].Equals(prefix)
114}
115
74// GetAttrPath is a convenience method to start a new Path with a GetAttrStep. 116// GetAttrPath is a convenience method to start a new Path with a GetAttrStep.
75func GetAttrPath(name string) Path { 117func GetAttrPath(name string) Path {
76 return Path{}.GetAttr(name) 118 return Path{}.GetAttr(name)