INNER CODE UNIT · Go
processFile
kluctl/kluctl · internal/replace-commands-help/main.go:52
func processFile(path string) {
text, err := ioutil.ReadFile(path)
if err != nil {
log.Fatal(err)
}
lines := strings.Split(string(text), "\n")
var newLines []string
pos := 0
for true {
s := findNextSection(lines, pos)
if s == nil {
newLines = append(newLines, lines[pos:]...)
break
}
newLines = append(newLines, lines[pos:s.start+1]...)