Skip to content

Commit

Permalink
acme/acmego: allow append at 0
Browse files Browse the repository at this point in the history
When a line is being added to the start of a document
(a classic example being when `gofmt` adds a `//go:build` line),
the diff logic was ignoring it and thus always thinking that
the file needed changes without ever actually applying the
changes.
  • Loading branch information
rogpeppe committed Dec 17, 2021
1 parent 5228387 commit ae1270f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion acme/acmego/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func reformat(id int, name string, formatter []string) {
}
oldStart, oldEnd := parseSpan(line[:j])
newStart, newEnd := parseSpan(line[j+1:])
if oldStart == 0 || newStart == 0 {
if newStart == 0 || (oldStart == 0 && line[j] != 'a') {
continue
}
switch line[j] {
Expand Down

0 comments on commit ae1270f

Please sign in to comment.