🚨 Lint fixes

This commit is contained in:
makeworld 2020-12-17 11:37:48 -05:00
parent 90089cba0a
commit 2043ed7212
4 changed files with 5 additions and 6 deletions

View File

@ -25,7 +25,6 @@ linters:
- lll
- maligned
- misspell
- nakedret
- nolintlint
- prealloc
- scopelint

View File

@ -377,7 +377,7 @@ func handleURL(t *tab, u string, numRedirects int) (string, bool) {
if errors.Is(err, renderer.ErrTooLarge) {
// Downloading now
// Disable read timeout and go back to start
res.SetReadTimeout(0)
res.SetReadTimeout(0) //nolint: errcheck
res.Body.(*rr.RestartReader).Restart()
go dlChoice("That page is too large. What would you like to do?", u, res)
return ret("", false)
@ -385,7 +385,7 @@ func handleURL(t *tab, u string, numRedirects int) (string, bool) {
if errors.Is(err, renderer.ErrTimedOut) {
// Downloading now
// Disable read timeout and go back to start
res.SetReadTimeout(0)
res.SetReadTimeout(0) //nolint: errcheck
res.Body.(*rr.RestartReader).Restart()
go dlChoice("Loading that page timed out. What would you like to do?", u, res)
return ret("", false)
@ -501,7 +501,7 @@ func handleURL(t *tab, u string, numRedirects int) (string, bool) {
if !added {
// Otherwise offer download choices
// Disable read timeout and go back to start
res.SetReadTimeout(0)
res.SetReadTimeout(0) //nolint: errcheck
res.Body.(*rr.RestartReader).Restart()
go dlChoice("That file could not be displayed. What would you like to do?", u, res)
}
@ -511,7 +511,7 @@ func handleURL(t *tab, u string, numRedirects int) (string, bool) {
// Otherwise offer download choices
// Disable read timeout and go back to start
res.SetReadTimeout(0)
res.SetReadTimeout(0) //nolint: errcheck
res.Body.(*rr.RestartReader).Restart()
go dlChoice("That file could not be displayed. What would you like to do?", u, res)
return ret("", false)

View File

@ -5,7 +5,6 @@ import (
"io"
)
// ErrTooLarge is passed to panic if memory cannot be allocated to store data in a buffer.
var ErrClosed = errors.New("RestartReader: closed")
type RestartReader struct {

View File

@ -23,6 +23,7 @@ func TestRead(t *testing.T) {
assert.Equal(t, []byte{'1'}, p, "should have read one byte, '1'")
}
//nolint
func TestRestart(t *testing.T) {
reset()
p := make([]byte, 4)