Skip to content

Commit cd971d2

Browse files
committed
tests: add delete last line
1 parent c860f67 commit cd971d2

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

pkg/golinters/internal/diff.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ func ExtractDiagnosticFromPatch(
252252

253253
func toDiagnostic(ft *token.File, change Change, adjLine int) analysis.Diagnostic {
254254
from := change.From + adjLine
255-
if from > ft.LineCount() {
256-
from = ft.LineCount()
257-
}
255+
// if from > ft.LineCount() {
256+
// from = ft.LineCount()
257+
// }
258258

259259
start := ft.LineStart(from)
260260

pkg/golinters/internal/diff_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ func Test_parse(t *testing.T) {
1919
log logutils.Log
2020
expected []Change
2121
}{
22+
{
23+
diff: "delete_last_line.diff",
24+
expected: []Change{{
25+
From: 10,
26+
To: 10,
27+
}},
28+
},
2229
{
2330
diff: "delete_only_first_lines.diff",
2431
expected: []Change{{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
diff --git i/main.go w/main.go
2+
index ef3cbb7..52a7925 100644
3+
--- i/main.go
4+
+++ w/main.go
5+
@@ -7,4 +7,3 @@ import (
6+
func main() {
7+
fmt.Println("hello world")
8+
}
9+
-

0 commit comments

Comments
 (0)