Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Terraform
Commits
80e83fed
Commit
80e83fed
authored
7 years ago
by
Martin Atkins
Browse files
Options
Download
Email Patches
Plain Diff
govendor fetch github.com/zclconf/go-cty/...
parent
6ed5d888
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
vendor/github.com/zclconf/go-cty/cty/set_internals.go
+15
-3
vendor/github.com/zclconf/go-cty/cty/set_internals.go
vendor/github.com/zclconf/go-cty/cty/unknown_as_null.go
+64
-0
vendor/github.com/zclconf/go-cty/cty/unknown_as_null.go
vendor/github.com/zclconf/go-cty/cty/value_ops.go
+4
-0
vendor/github.com/zclconf/go-cty/cty/value_ops.go
vendor/vendor.json
+15
-15
vendor/vendor.json
with
98 additions
and
18 deletions
+98
-18
vendor/github.com/zclconf/go-cty/cty/set_internals.go
+
15
-
3
View file @
80e83fed
...
...
@@ -19,12 +19,24 @@ type setRules struct {
Type
Type
}
// Hash returns a hash value for the receiver that can be used for equality
// checks where some inaccuracy is tolerable.
//
// The hash function is value-type-specific, so it is not meaningful to compare
// hash results for values of different types.
//
// This function is not safe to use for security-related applications, since
// the hash used is not strong enough.
func
(
val
Value
)
Hash
()
int
{
hashBytes
:=
makeSetHashBytes
(
val
)
return
int
(
crc32
.
ChecksumIEEE
(
hashBytes
))
}
func
(
r
setRules
)
Hash
(
v
interface
{})
int
{
hashBytes
:=
makeSetHashBytes
(
Value
{
return
Value
{
ty
:
r
.
Type
,
v
:
v
,
})
return
int
(
crc32
.
ChecksumIEEE
(
hashBytes
))
}
.
Hash
()
}
func
(
r
setRules
)
Equivalent
(
v1
interface
{},
v2
interface
{})
bool
{
...
...
This diff is collapsed.
Click to expand it.
vendor/github.com/zclconf/go-cty/cty/unknown_as_null.go
0 → 100644
+
64
-
0
View file @
80e83fed
package
cty
// UnknownAsNull returns a value of the same type as the given value but
// with any unknown values (including nested values) replaced with null
// values of the same type.
//
// This can be useful if a result is to be serialized in a format that can't
// represent unknowns, such as JSON, as long as the caller does not need to
// retain the unknown value information.
func
UnknownAsNull
(
val
Value
)
Value
{
if
!
val
.
IsKnown
()
{
return
NullVal
(
val
.
Type
())
}
ty
:=
val
.
Type
()
switch
{
case
ty
.
IsListType
()
||
ty
.
IsTupleType
()
||
ty
.
IsSetType
()
:
length
:=
val
.
LengthInt
()
if
length
==
0
{
// If there are no elements then we can't have unknowns
return
val
}
vals
:=
make
([]
Value
,
0
,
length
)
it
:=
val
.
ElementIterator
()
for
it
.
Next
()
{
_
,
v
:=
it
.
Element
()
vals
=
append
(
vals
,
UnknownAsNull
(
v
))
}
switch
{
case
ty
.
IsListType
()
:
return
ListVal
(
vals
)
case
ty
.
IsTupleType
()
:
return
TupleVal
(
vals
)
default
:
return
SetVal
(
vals
)
}
case
ty
.
IsMapType
()
||
ty
.
IsObjectType
()
:
var
length
int
switch
{
case
ty
.
IsMapType
()
:
length
=
val
.
LengthInt
()
default
:
length
=
len
(
val
.
Type
()
.
AttributeTypes
())
}
if
length
==
0
{
// If there are no elements then we can't have unknowns
return
val
}
vals
:=
make
(
map
[
string
]
Value
,
length
)
it
:=
val
.
ElementIterator
()
for
it
.
Next
()
{
k
,
v
:=
it
.
Element
()
vals
[
k
.
AsString
()]
=
UnknownAsNull
(
v
)
}
switch
{
case
ty
.
IsMapType
()
:
return
MapVal
(
vals
)
default
:
return
ObjectVal
(
vals
)
}
}
return
val
}
This diff is collapsed.
Click to expand it.
vendor/github.com/zclconf/go-cty/cty/value_ops.go
+
4
-
0
View file @
80e83fed
...
...
@@ -800,6 +800,10 @@ func (val Value) LengthInt() int {
// For tuples, we can return the length even if the value is not known.
return
val
.
Type
()
.
Length
()
}
if
val
.
Type
()
.
IsObjectType
()
{
// For objects, the length is the number of attributes associated with the type.
return
len
(
val
.
Type
()
.
AttributeTypes
())
}
if
!
val
.
IsKnown
()
{
panic
(
"value is not known"
)
}
...
...
This diff is collapsed.
Click to expand it.
vendor/vendor.json
+
15
-
15
View file @
80e83fed
...
...
@@ -2238,46 +2238,46 @@
"revisionTime"
:
"2016-10-29T10:40:18Z"
},
{
"checksumSHA1"
:
"
lGCvuEPfb2vhxEgYamNhnd1jYH8
="
,
"checksumSHA1"
:
"
4REWNRi5Dg7Kxj1US72+/oVii3Q
="
,
"path"
:
"github.com/zclconf/go-cty/cty"
,
"revision"
:
"
49fa5e03c418f95f78684c91e155af06aa901a32
"
,
"revisionTime"
:
"2018-03-
02T16:03:48
Z"
"revision"
:
"
b7d1e828d86e99040528ce06ce970382c7813f96
"
,
"revisionTime"
:
"2018-03-
26T23:07:54
Z"
},
{
"checksumSHA1"
:
"gDpi8g5VxCRM3JKm/kaYlGdFUdQ="
,
"path"
:
"github.com/zclconf/go-cty/cty/convert"
,
"revision"
:
"
49fa5e03c418f95f78684c91e155af06aa901a32
"
,
"revisionTime"
:
"2018-03-
02T16:03:48
Z"
"revision"
:
"
b7d1e828d86e99040528ce06ce970382c7813f96
"
,
"revisionTime"
:
"2018-03-
26T23:07:54
Z"
},
{
"checksumSHA1"
:
"MyyLCGg3RREMllTJyK6ehZl/dHk="
,
"path"
:
"github.com/zclconf/go-cty/cty/function"
,
"revision"
:
"
49fa5e03c418f95f78684c91e155af06aa901a32
"
,
"revisionTime"
:
"2018-03-
02T16:03:48
Z"
"revision"
:
"
b7d1e828d86e99040528ce06ce970382c7813f96
"
,
"revisionTime"
:
"2018-03-
26T23:07:54
Z"
},
{
"checksumSHA1"
:
"4R+DQqBew6i9a4lYiLZW1OXVwTI="
,
"path"
:
"github.com/zclconf/go-cty/cty/function/stdlib"
,
"revision"
:
"
49fa5e03c418f95f78684c91e155af06aa901a32
"
,
"revisionTime"
:
"2018-03-
02T16:03:48
Z"
"revision"
:
"
b7d1e828d86e99040528ce06ce970382c7813f96
"
,
"revisionTime"
:
"2018-03-
26T23:07:54
Z"
},
{
"checksumSHA1"
:
"tmCzwfNXOEB1sSO7TKVzilb2vjA="
,
"path"
:
"github.com/zclconf/go-cty/cty/gocty"
,
"revision"
:
"
49fa5e03c418f95f78684c91e155af06aa901a32
"
,
"revisionTime"
:
"2018-03-
02T16:03:48
Z"
"revision"
:
"
b7d1e828d86e99040528ce06ce970382c7813f96
"
,
"revisionTime"
:
"2018-03-
26T23:07:54
Z"
},
{
"checksumSHA1"
:
"1ApmO+Q33+Oem/3f6BU6sztJWNc="
,
"path"
:
"github.com/zclconf/go-cty/cty/json"
,
"revision"
:
"
49fa5e03c418f95f78684c91e155af06aa901a32
"
,
"revisionTime"
:
"2018-03-
02T16:03:48
Z"
"revision"
:
"
b7d1e828d86e99040528ce06ce970382c7813f96
"
,
"revisionTime"
:
"2018-03-
26T23:07:54
Z"
},
{
"checksumSHA1"
:
"y5Sk+n6SOspFj8mlyb8swr4DMIs="
,
"path"
:
"github.com/zclconf/go-cty/cty/set"
,
"revision"
:
"
49fa5e03c418f95f78684c91e155af06aa901a32
"
,
"revisionTime"
:
"2018-03-
02T16:03:48
Z"
"revision"
:
"
b7d1e828d86e99040528ce06ce970382c7813f96
"
,
"revisionTime"
:
"2018-03-
26T23:07:54
Z"
},
{
"checksumSHA1"
:
"vE43s37+4CJ2CDU6TlOUOYE0K9c="
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment