-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix transform property value to preserve nil arrays and objects (#2655)
The `propertyvalue.Transform` functions had a bug where it would always mutate nil arrays and maps into empty ones: ``` value=resource.PropertyValue{} ``` would become: ``` value=resource.PropertyValue{ V: []resource.PropertyValue{ }, } ``` This had to do with typed nil interfaces in go: https://dave.cheney.net/2017/08/09/typed-nils-in-go-2 The `V` in `resource.PropertyValue` is an interface, so it might be non-nil `!= nil` but the underlying value is nil. This change adds a fix and some tests for the problem.
- Loading branch information
1 parent
37482e6
commit 83596bb
Showing
2 changed files
with
71 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters