Skip to content

Commit c9c5088

Browse files
committed
review
1 parent 812f241 commit c9c5088

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/fsutils/linecache.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package fsutils
22

33
import (
44
"bytes"
5-
"cmp"
65
"fmt"
76
"sync"
87
)
@@ -22,7 +21,9 @@ func NewLineCache(fc *FileCache) *LineCache {
2221

2322
// GetLine returns the index1-th (1-based index) line from the file on filePath
2423
func (lc *LineCache) GetLine(filePath string, index1 int) (string, error) {
25-
index1 = cmp.Or(index1, 1) // some linters, e.g. gosec can return 0: it really means first line
24+
if index1 == 0 { // some linters, e.g. gosec can do it: it really means first line
25+
index1 = 1
26+
}
2627

2728
const index1To0Offset = -1
2829
rawLine, err := lc.getRawLine(filePath, index1+index1To0Offset)

0 commit comments

Comments
 (0)