mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Do not delete text that fails preformat-balance
If preformat lines are unbalanced, do not delete all the lines from there to end of file. That might be the only copy of edits made by the user. Do not print entire file contents for munge errors affecting entire file.
This commit is contained in:
@@ -45,7 +45,7 @@ func updatePreformatted(filePath string, mlines mungeLines) (mungeLines, error)
|
||||
// If the file ends on a preformatted line, there must have been an imbalance.
|
||||
func checkPreformatBalance(filePath string, mlines mungeLines) (mungeLines, error) {
|
||||
if len(mlines) > 0 && mlines[len(mlines)-1].preformatted {
|
||||
return nil, fmt.Errorf("file ends in preformatted block")
|
||||
return mlines, fmt.Errorf("unbalanced triple backtick delimiters")
|
||||
}
|
||||
return mlines, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user