MCPcopy Index your code
hub / github.com/devspace-sh/devspace / copyForValidation

Function copyForValidation

pkg/devspace/config/loader/loader.go:691–717  ·  view source on GitHub ↗
(profile interface{})

Source from the content-addressed store, hash-verified

689}
690
691func copyForValidation(profile interface{}) (*latest.ProfileConfig, error) {
692 profileMap, ok := profile.(map[string]interface{})
693 if !ok {
694 return nil, fmt.Errorf("error loading profiles: invalid format")
695 }
696
697 clone := map[string]interface{}{
698 "name": profileMap["name"],
699 "parent": profileMap["parent"],
700 "parents": profileMap["parents"],
701 "patches": profileMap["patches"],
702 "activation": profileMap["activation"],
703 }
704
705 o, err := yaml.Marshal(clone)
706 if err != nil {
707 return nil, err
708 }
709
710 profileConfig := &latest.ProfileConfig{}
711 err = yamlutil.UnmarshalStrict(o, profileConfig)
712 if err != nil {
713 return nil, err
714 }
715
716 return profileConfig, nil
717}

Callers 1

validateProfileFunction · 0.85

Calls 2

UnmarshalStrictFunction · 0.92
ErrorfMethod · 0.45

Tested by

no test coverage detected