🚨 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 - lll
- maligned - maligned
- misspell - misspell
- nakedret
- nolintlint - nolintlint
- prealloc - prealloc
- scopelint - scopelint

View File

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

View File

@ -5,7 +5,6 @@ import (
"io" "io"
) )
// ErrTooLarge is passed to panic if memory cannot be allocated to store data in a buffer.
var ErrClosed = errors.New("RestartReader: closed") var ErrClosed = errors.New("RestartReader: closed")
type RestartReader struct { 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'") assert.Equal(t, []byte{'1'}, p, "should have read one byte, '1'")
} }
//nolint
func TestRestart(t *testing.T) { func TestRestart(t *testing.T) {
reset() reset()
p := make([]byte, 4) p := make([]byte, 4)