1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-18 08:14:56 +00:00

If map, don't encode

This commit is contained in:
Darren Shepherd
2018-02-14 16:38:41 -07:00
parent 94b274ab75
commit e39bcf5ee4

View File

@@ -198,6 +198,10 @@ func ToObj(data interface{}, into interface{}) error {
}
func EncodeToMap(obj interface{}) (map[string]interface{}, error) {
if m, ok := obj.(map[string]interface{}); ok {
return m, nil
}
b, err := json.Marshal(obj)
if err != nil {
return nil, err