1
1
mirror of https://github.com/walles/moar.git synced 2024-08-16 07:20:31 +03:00

Handle some unused parameters issues

This commit is contained in:
Johan Walles 2023-03-03 16:56:09 +01:00
parent bc5260c95b
commit 7bd5d3e099
4 changed files with 11 additions and 5 deletions

View File

@ -1,3 +1,9 @@
linters:
enable:
- 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

View File

@ -27,7 +27,7 @@ func highlight(filename string, force bool, style chroma.Style, formatter chroma
if err != nil {
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",
filename, fileInfo.Size(), MAX_HIGHLIGHT_SIZE)
return nil, nil

View File

@ -95,7 +95,7 @@ func TestBrokenUtf8(t *testing.T) {
func startPaging(t *testing.T, reader *Reader) *twin.FakeScreen {
err := reader._wait()
if err != nil {
panic(err)
t.Fatalf("Failed waiting for reader: %v", err)
}
screen := twin.NewFakeScreen(20, 10)

View File

@ -448,7 +448,7 @@ func NewReaderFromFilename(filename string, style chroma.Style, formatter chroma
}
// 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 := ""
if r.name != nil {
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
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{
lines: r.lines[firstLineZeroBased : lastLineZeroBased+1],
firstLineOneBased: firstLineOneBased,
statusText: r.createStatusUnlocked(firstLineOneBased, lastLineZeroBased+1),
statusText: r.createStatusUnlocked(lastLineZeroBased + 1),
}
}