* Various cleanups around the codebase
- unindent the else after return
- make things private that are not used anywhere
- rearrange params
- etc
* add
* Improve kmp.ShortDiff when one object is invalid
* Both are invalid throw an error
* If x is invalid and y is valid, add '+' prefix and no '-'
* If x is valid and y is invalid, add '-' prefix and not '+'
* * Extract diffString method for reduce duplicated code
* Add a map with missing key test case
* * Direct return diff string
* Map add a key unit test
* Upgrade go-cmp and add new diff options to kmp
* Upgrades go-cmp to master
* Adds new kmp diff options (FieldListReporter and ShortDiffReporter)
* Update comments
FieldListReporter can be used to programatically find what fields differ
between two objects. This is useful in webhook object validation.
ShortDiffReporter was added as the default behavior for cmp.Diff is to
provide more context. The ShortDiff reporter is useful for use on API
fields where context is not necessarily as valuable. This keeps the
output short for use in log and error messages.
* Change from override to constraint
* Code Review Comments
* Improve test coverage
* Use JSON field names when present
No longer lowercase golang field names.
* Strip JSON non-key tag content
* Some fixes to the spoof.go and exporter.go
While reviewing some other CL, I saw some avenues for improving
spoof.go, to log the URL that's being fetched, which would help in test
debugging and to use switch construct, rather than nested if's.
While testing the change, I noticed some shifty loggin from the
exporter, so I fixed that as well while I was there.
* Continuation of the previous cleanups.
* Fix the issues with formatting by executing a grep
* and fix compilation error
* lowercase error
* fix the newly changed unit test
* duck typing - add a ConformsToType helper
Unlike VerifyType, ConformsToType will return the following:
- an error when any marshalling/unmarshalling fails
- false when the concrete type does not implement the duck type
- true when the concrete type implements the duck type
* use knative/pkg kmp to handle panics raised by go-cmp
* Add kcmp, a safe wrapper for google/go-cmp
* Returns an error instead of panicking.
* Holds common options that we use.
* Rename things
kcmp -> kmp
Diff -> SafeDiff