blendle/kubecrt

Wrong line number returned in error description

JeanMertz opened this issue · 0 comments

See #21.

I suspect this is happening here:

func errorLine(err error) (int, string) {
var i int
var p []string
str := err.Error()
println(str)
if strings.HasPrefix(str, "yaml: ") {
p = strings.SplitN(str, ":", 3)
i, _ = strconv.Atoi(strings.Replace(p[1], " line ", "", -1))
str = strings.TrimSpace(p[2])
}
if strings.HasPrefix(str, "template: test:") {
p = strings.SplitN(str, ":", 4)
i, _ = strconv.Atoi(p[2])
str = strings.TrimSpace(p[3])
}
return i, "Templating error: " + str
}