style: prefer stdlib idioms for errors and http methods

This commit is contained in:
Mathis Maquenne
2026-08-05 21:43:59 +02:00
parent a695fb4de3
commit c1775e5c04
12 changed files with 50 additions and 44 deletions
+4 -3
View File
@@ -1,6 +1,7 @@
package download
import (
"errors"
"fmt"
"time"
@@ -27,14 +28,14 @@ func (o *Options) Validate(kind deezer.Kind) error {
return fmt.Errorf("invalid quality option: %s", o.Quality)
}
if o.Timeout <= 0 {
return fmt.Errorf("timeout must be a positive duration")
return errors.New("timeout must be a positive duration")
}
if kind == deezer.KindArtist {
if o.Limit <= 0 {
return fmt.Errorf("limit must be a positive integer")
return errors.New("limit must be a positive integer")
}
if o.Limit > 100 {
return fmt.Errorf("limit must not exceed 100")
return errors.New("limit must not exceed 100")
}
}