From 53a4bf0140400eb1ef57e1e8f7c35512a1a36c89 Mon Sep 17 00:00:00 2001 From: Jamison Lahman Date: Wed, 25 Dec 2024 14:28:21 -0800 Subject: [PATCH] fix lint --- main.go | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/main.go b/main.go index f3971b7..962e217 100644 --- a/main.go +++ b/main.go @@ -94,15 +94,6 @@ type Sound struct { url string } -type readCloserWrapper struct { - io.Reader - closer io.Closer -} - -func (rc *readCloserWrapper) Close() error { - return rc.closer.Close() -} - type ProgressReader struct { Reader io.Reader TotalSize int64 @@ -140,10 +131,7 @@ func downloadFileWithProgress(url, filepath string) error { return fmt.Errorf("bad status: %s", resp.Status) } - contentLength, err := strconv.Atoi(resp.Header.Get("Content-Length")) - if err != nil || contentLength <= 0 { - // We don't always get the Content-Length ahead of time and thus is life. - } + contentLength, _ := strconv.Atoi(resp.Header.Get("Content-Length")) progressReader := &ProgressReader{ Reader: resp.Body, @@ -336,10 +324,8 @@ func main() { defer file.Close() defer stream.Close() - err = saveNowPlaying(dataDir, nowPlaying) - if err != nil { - // TODO: Warn on error. - } + // TODO: Warn on error. + _ = saveNowPlaying(dataDir, nowPlaying) if err := keyboard.Open(); err != nil { log.Fatal("Error opening keyboard: ", err) @@ -401,10 +387,8 @@ func main() { nowPlaying = sounds[soundIndex] } - err = saveNowPlaying(dataDir, nowPlaying) - if err != nil { - // TODO: Warn on error. - } + // TODO: Warn on error. + _ = saveNowPlaying(dataDir, nowPlaying) if err := keyboard.Open(); err != nil { log.Fatal("Error opening keyboard: ", err)