mirror of
https://github.com/kubesphere/kubesphere.git
synced 2026-10-23 01:58:37 +08:00
13 lines
231 B
Go
13 lines
231 B
Go
package testing
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"k8s.io/apimachinery/pkg/util/yaml"
|
|
)
|
|
|
|
func StringToObject(data string, obj interface{}) error {
|
|
reader := strings.NewReader(data)
|
|
return yaml.NewYAMLOrJSONDecoder(reader, 10).Decode(obj)
|
|
}
|