declare new errs inline if
This commit is contained in:
@@ -299,7 +299,7 @@ func (c *Client) makeRequest(method string, params url.Values) (LastFM, error) {
|
||||
defer resp.Body.Close()
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ func (p *Podcasts) RefreshPodcasts() error {
|
||||
errs = append(errs, fmt.Errorf("refreshing podcast with url %q: %w", podcast.URL, err))
|
||||
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))
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ func coverScaleAndSave(reader io.Reader, cachePath string, size int) error {
|
||||
// don't upscale images
|
||||
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 nil
|
||||
|
||||
Reference in New Issue
Block a user