@@ -36,12 +36,15 @@ func Unmarshal(data []byte, out interface{}) error {
3636func prettifyError (data []byte , err error ) error {
3737 // check if type error
3838 if typeError , ok := err .(* yaml.TypeError ); ok {
39- for i , message := range typeError .Errors {
40- typeError .Errors [i ] = strings .Replace (message , "!!seq" , "an array" , - 1 )
41- typeError .Errors [i ] = strings .Replace (message , "!!str" , "string" , - 1 )
39+ for i := range typeError .Errors {
40+ typeError .Errors [i ] = strings .Replace (typeError .Errors [i ], "!!seq" , "an array" , - 1 )
41+ typeError .Errors [i ] = strings .Replace (typeError .Errors [i ], "!!str" , "string" , - 1 )
42+ typeError .Errors [i ] = strings .Replace (typeError .Errors [i ], "!!map" , "an object" , - 1 )
43+ typeError .Errors [i ] = strings .Replace (typeError .Errors [i ], "!!int" , "number" , - 1 )
44+ typeError .Errors [i ] = strings .Replace (typeError .Errors [i ], "!!bool" , "boolean" , - 1 )
4245
4346 // add line to error
44- match := lineRegEx .FindSubmatch ([]byte (message ))
47+ match := lineRegEx .FindSubmatch ([]byte (typeError . Errors [ i ] ))
4548 if len (match ) > 1 {
4649 line , lineErr := strconv .Atoi (string (match [1 ]))
4750 if lineErr == nil {
0 commit comments