declare new errs inline if

This commit is contained in:
sentriz
2024-02-20 13:14:13 +00:00
parent 70ff70cdfa
commit c6cec8307a
3 changed files with 3 additions and 3 deletions

View File

@@ -299,7 +299,7 @@ func (c *Client) makeRequest(method string, params url.Values) (LastFM, error) {
defer resp.Body.Close() defer resp.Body.Close()
var lastfm LastFM var lastfm LastFM
if err = xml.NewDecoder(resp.Body).Decode(&lastfm); err != nil { if err := xml.NewDecoder(resp.Body).Decode(&lastfm); err != nil {
return LastFM{}, fmt.Errorf("decoding: %w", err) return LastFM{}, fmt.Errorf("decoding: %w", err)
} }

View File

@@ -253,7 +253,7 @@ func (p *Podcasts) RefreshPodcasts() error {
errs = append(errs, fmt.Errorf("refreshing podcast with url %q: %w", podcast.URL, err)) errs = append(errs, fmt.Errorf("refreshing podcast with url %q: %w", podcast.URL, err))
continue continue
} }
if err = p.RefreshPodcast(podcast, feed.Items); err != nil { if err := p.RefreshPodcast(podcast, feed.Items); err != nil {
errs = append(errs, fmt.Errorf("adding episodes: %w", err)) errs = append(errs, fmt.Errorf("adding episodes: %w", err))
continue continue
} }

View File

@@ -160,7 +160,7 @@ func coverScaleAndSave(reader io.Reader, cachePath string, size int) error {
// don't upscale images // don't upscale images
width = src.Bounds().Dx() width = src.Bounds().Dx()
} }
if err = imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath); err != nil { if err := imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath); err != nil {
return fmt.Errorf("caching %q: %w", cachePath, err) return fmt.Errorf("caching %q: %w", cachePath, err)
} }
return nil return nil