INNER CODE UNIT · Go
refreshLine
abahmed/kwatch · cmd/configcatalog/main.go:205
func refreshLine(
path, line string, t reflect.Type, value reflect.Value,
) string {
parts := strings.SplitN(line, "|", 7)
if len(parts) != 7 || emptyCollection(t, value) {
return line
}
fresh := strings.SplitN(
catalogLine(parts[0], t, value, metadata{}), "|", 7,
)
parts[1], parts[2] = fresh[1], fresh[2]
if effective, ok := effectiveDefaults[path]; ok {
parts[2] = effective
}
return strings.Join(parts, "|")
}
func emptyCollection(t reflect.Type, value reflect.Value) bool {