mirror of
https://github.com/hashicorp/terraform.git
synced 2026-02-03 20:50:59 -05:00
GetDeprecationMarks should return other value marks in value
This commit is contained in:
parent
9d359b02c4
commit
ce400c93df
1 changed files with 7 additions and 3 deletions
|
|
@ -51,21 +51,25 @@ func Contains(val cty.Value, mark interface{}) bool {
|
|||
|
||||
// FilterDeprecationMarks returns all deprecation marks present in the given
|
||||
// cty.ValueMarks.
|
||||
func FilterDeprecationMarks(marks cty.ValueMarks) []DeprecationMark {
|
||||
func FilterDeprecationMarks(marks cty.ValueMarks) (cty.ValueMarks, []DeprecationMark) {
|
||||
other := cty.ValueMarks{}
|
||||
depMarks := []DeprecationMark{}
|
||||
for mark := range marks {
|
||||
if d, ok := mark.(DeprecationMark); ok {
|
||||
depMarks = append(depMarks, d)
|
||||
} else {
|
||||
other[mark] = struct{}{}
|
||||
}
|
||||
}
|
||||
return depMarks
|
||||
return other, depMarks
|
||||
}
|
||||
|
||||
// GetDeprecationMarks returns all deprecation marks present on the given
|
||||
// cty.Value.
|
||||
func GetDeprecationMarks(val cty.Value) (cty.Value, []DeprecationMark) {
|
||||
unmarked, marks := val.Unmark()
|
||||
return unmarked, FilterDeprecationMarks(marks)
|
||||
other, depMarks := FilterDeprecationMarks(marks)
|
||||
return unmarked.WithMarks(other), depMarks
|
||||
}
|
||||
|
||||
// RemoveDeprecationMarks returns a copy of the given cty.Value with all
|
||||
|
|
|
|||
Loading…
Reference in a new issue