mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-07 12:11:43 +00:00
util.EncodeJSON proven harmful, remove it everywhere
People were misusing EncodeJSON in tests when they should be using runtime.EncodeOrDie(testapi.Codec(), obj). Removing the potential for cutting self on sharp objects.
This commit is contained in:
@@ -60,12 +60,6 @@ func Forever(f func(), period time.Duration) {
|
||||
}
|
||||
}
|
||||
|
||||
// EncodeJSON returns obj marshalled as a JSON string, ignoring any errors.
|
||||
func EncodeJSON(obj interface{}) string {
|
||||
data, _ := json.Marshal(obj)
|
||||
return string(data)
|
||||
}
|
||||
|
||||
// IntOrString is a type that can hold an int or a string. When used in
|
||||
// JSON or YAML marshalling and unmarshalling, it produces or consumes the
|
||||
// inner type. This allows you to have, for example, a JSON field that can
|
||||
|
Reference in New Issue
Block a user