don't backtick quote stuff

This commit is contained in:
sentriz
2023-10-19 02:17:39 +01:00
parent d503282faf
commit 95bc919377
6 changed files with 13 additions and 13 deletions

View File

@@ -206,7 +206,7 @@ func withRequiredParams(next http.Handler) http.Handler {
params := r.Context().Value(CtxParams).(params.Params)
for _, req := range requiredParameters {
if _, err := params.Get(req); err != nil {
_ = writeResp(w, r, spec.NewError(10, "please provide a `%s` parameter", req))
_ = writeResp(w, r, spec.NewError(10, "please provide a %q parameter", req))
return
}
}
@@ -234,7 +234,7 @@ func withUser(dbc *db.DB) handlerutil.Middleware {
user := dbc.GetUserByName(username)
if user == nil {
_ = writeResp(w, r, spec.NewError(40,
"invalid username `%s`", username))
"invalid username %q", username))
return
}
var credsOk bool

View File

@@ -160,7 +160,7 @@ func (c *Controller) ServeGetAlbumList(r *http.Request) *spec.Response {
q = q.Joins("JOIN album_stars ON albums.id=album_stars.album_id AND album_stars.user_id=?", user.ID)
q = q.Order("right_path")
default:
return spec.NewError(10, "unknown value `%s` for parameter 'type'", v)
return spec.NewError(10, "unknown value %q for parameter 'type'", v)
}
if m := getMusicFolder(c.musicPaths, params); m != "" {

View File

@@ -174,7 +174,7 @@ func (c *Controller) ServeGetAlbumListTwo(r *http.Request) *spec.Response {
q = q.Joins("JOIN album_stars ON albums.id=album_stars.album_id AND album_stars.user_id=?", user.ID)
q = q.Order("tag_title")
default:
return spec.NewError(10, "unknown value `%s` for parameter 'type'", listType)
return spec.NewError(10, "unknown value %q for parameter 'type'", listType)
}
if m := getMusicFolder(c.musicPaths, params); m != "" {
q = q.Where("root_dir=?", m)
@@ -314,7 +314,7 @@ func (c *Controller) ServeGetArtistInfoTwo(r *http.Request) *spec.Response {
Find(&artist).
Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return spec.NewError(70, "artist with id `%s` not found", id)
return spec.NewError(70, "artist with id %q not found", id)
}
sub := spec.NewResponse()
@@ -665,7 +665,7 @@ func (c *Controller) ServeGetSimilarSongsTwo(r *http.Request) *spec.Response {
First(&artist).
Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return spec.NewError(0, "artist with id `%s` not found", id)
return spec.NewError(0, "artist with id %q not found", id)
}
similarArtists, err := c.lastFMClient.ArtistGetSimilar(artist.Name)

View File

@@ -51,7 +51,7 @@ func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *s
case os.IsNotExist(err):
reader, err := coverFor(c.dbc, c.artistInfoCache, id)
if err != nil {
return spec.NewError(10, "couldn't find cover `%s`: %v", id, err)
return spec.NewError(10, "couldn't find cover %q: %v", id, err)
}
defer reader.Close()
@@ -60,7 +60,7 @@ func (c *Controller) ServeGetCoverArt(w http.ResponseWriter, r *http.Request) *s
return nil
}
case err != nil:
log.Printf("error stating `%s`: %v", cachePath, err)
log.Printf("error stating %q: %v", cachePath, err)
return nil
}
@@ -161,7 +161,7 @@ func coverScaleAndSave(reader io.Reader, cachePath string, size int) error {
width = src.Bounds().Dx()
}
if err = imaging.Save(imaging.Resize(src, width, 0, imaging.Lanczos), cachePath); err != nil {
return fmt.Errorf("caching `%s`: %w", cachePath, err)
return fmt.Errorf("caching %q: %w", cachePath, err)
}
return nil
}