INNER CODE UNIT · Go
Load
aylei/kubectl-debug · pkg/agent/config.go:41
func Load(s string) (*Config, error) {
cfg := &Config{}
// If the entire config body is empty the UnmarshalYAML method is
// never called. We thus have to set the DefaultConfig at the entry
// point as well.
*cfg = DefaultConfig
err := yaml.UnmarshalStrict([]byte(s), cfg)
fmt.Printf("Config after reading from file %v\r\n", cfg)
if err != nil {
return nil, err
}
return cfg, nil
}
func LoadFile(filename string) (*Config, error) {
if len(filename) < 1 {
fmt.Println("No config file provided. Using all default values.")