We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 812f241 commit c9c5088Copy full SHA for c9c5088
pkg/fsutils/linecache.go
@@ -2,7 +2,6 @@ package fsutils
2
3
import (
4
"bytes"
5
- "cmp"
6
"fmt"
7
"sync"
8
)
@@ -22,7 +21,9 @@ func NewLineCache(fc *FileCache) *LineCache {
22
21
23
// GetLine returns the index1-th (1-based index) line from the file on filePath
24
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
+ if index1 == 0 { // some linters, e.g. gosec can do it: it really means first line
+ index1 = 1
26
+ }
27
28
const index1To0Offset = -1
29
rawLine, err := lc.getRawLine(filePath, index1+index1To0Offset)
0 commit comments