mirror of
https://github.com/walles/moar.git
synced 2024-09-11 12:15:43 +03:00
Handle some unused parameters issues
This commit is contained in:
parent
bc5260c95b
commit
7bd5d3e099
@ -1,3 +1,9 @@
|
|||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- gofmt
|
- gofmt
|
||||||
|
|
||||||
|
# I'd really want to use Revive for this but that doesn't work:
|
||||||
|
# https://github.com/golangci/golangci-lint/issues/3653
|
||||||
|
- unparam
|
||||||
|
|
||||||
|
- usestdlibvars
|
||||||
|
@ -27,7 +27,7 @@ func highlight(filename string, force bool, style chroma.Style, formatter chroma
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if fileInfo.Size() > MAX_HIGHLIGHT_SIZE {
|
if fileInfo.Size() > MAX_HIGHLIGHT_SIZE && !force {
|
||||||
log.Debugf("Not highlighting %s because it is %d bytes large, which is larger than moar's built-in highlighting limit of %d bytes",
|
log.Debugf("Not highlighting %s because it is %d bytes large, which is larger than moar's built-in highlighting limit of %d bytes",
|
||||||
filename, fileInfo.Size(), MAX_HIGHLIGHT_SIZE)
|
filename, fileInfo.Size(), MAX_HIGHLIGHT_SIZE)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
@ -95,7 +95,7 @@ func TestBrokenUtf8(t *testing.T) {
|
|||||||
func startPaging(t *testing.T, reader *Reader) *twin.FakeScreen {
|
func startPaging(t *testing.T, reader *Reader) *twin.FakeScreen {
|
||||||
err := reader._wait()
|
err := reader._wait()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
t.Fatalf("Failed waiting for reader: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
screen := twin.NewFakeScreen(20, 10)
|
screen := twin.NewFakeScreen(20, 10)
|
||||||
|
@ -448,7 +448,7 @@ func NewReaderFromFilename(filename string, style chroma.Style, formatter chroma
|
|||||||
}
|
}
|
||||||
|
|
||||||
// createStatusUnlocked() assumes that its caller is holding the lock
|
// createStatusUnlocked() assumes that its caller is holding the lock
|
||||||
func (r *Reader) createStatusUnlocked(firstLineOneBased int, lastLineOneBased int) string {
|
func (r *Reader) createStatusUnlocked(lastLineOneBased int) string {
|
||||||
prefix := ""
|
prefix := ""
|
||||||
if r.name != nil {
|
if r.name != nil {
|
||||||
prefix = path.Base(*r.name) + ": "
|
prefix = path.Base(*r.name) + ": "
|
||||||
@ -511,7 +511,7 @@ func (r *Reader) getLinesUnlocked(firstLineOneBased int, wantedLineCount int) *I
|
|||||||
// The line number set here won't matter, we'll clip it anyway when we get it back
|
// The line number set here won't matter, we'll clip it anyway when we get it back
|
||||||
firstLineOneBased: 0,
|
firstLineOneBased: 0,
|
||||||
|
|
||||||
statusText: r.createStatusUnlocked(0, 0),
|
statusText: r.createStatusUnlocked(0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ func (r *Reader) getLinesUnlocked(firstLineOneBased int, wantedLineCount int) *I
|
|||||||
return &InputLines{
|
return &InputLines{
|
||||||
lines: r.lines[firstLineZeroBased : lastLineZeroBased+1],
|
lines: r.lines[firstLineZeroBased : lastLineZeroBased+1],
|
||||||
firstLineOneBased: firstLineOneBased,
|
firstLineOneBased: firstLineOneBased,
|
||||||
statusText: r.createStatusUnlocked(firstLineOneBased, lastLineZeroBased+1),
|
statusText: r.createStatusUnlocked(lastLineZeroBased + 1),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user