Chore: Fix staticcheck issues (#28860)
* Chore: Fix issues reported by staticcheck Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Undo changes Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Chore: Fix issues reported by staticcheck Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix test Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix test Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
|
||||
var ErrInvalidApiKey = errors.New("Invalid Api Key")
|
||||
var ErrInvalidApiKey = errors.New("invalid API key")
|
||||
|
||||
type KeyGenResult struct {
|
||||
HashedKey string
|
||||
|
||||
@@ -245,7 +245,7 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
|
||||
case map[string]interface{}:
|
||||
// ok
|
||||
default:
|
||||
return errors.New("Type mismatch")
|
||||
return errors.New("type mismatch")
|
||||
}
|
||||
o := value.(map[string]interface{})
|
||||
|
||||
@@ -270,7 +270,7 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
|
||||
case []interface{}:
|
||||
// ok
|
||||
default:
|
||||
return errors.New("Type mismatch")
|
||||
return errors.New("type mismatch")
|
||||
}
|
||||
a := value.([]interface{})
|
||||
|
||||
@@ -310,7 +310,7 @@ func (f *JSONFormatter) processItem(value interface{}, deltas []diff.Delta, posi
|
||||
f.printRecursive(positionStr, matchedDelta.Value, ChangeDeleted)
|
||||
|
||||
default:
|
||||
return errors.New("Unknown Delta type detected")
|
||||
return errors.New("unknown Delta type detected")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -70,7 +70,7 @@ func NewImageUploader() (ImageUploader, error) {
|
||||
|
||||
url := webdavSec.Key("url").String()
|
||||
if url == "" {
|
||||
return nil, fmt.Errorf("Could not find url key for image.uploader.webdav")
|
||||
return nil, fmt.Errorf("could not find URL key for image.uploader.webdav")
|
||||
}
|
||||
|
||||
public_url := webdavSec.Key("public_url").String()
|
||||
@@ -153,5 +153,5 @@ func getRegionAndBucketFromUrl(url string) (*s3Info, error) {
|
||||
return info, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("Could not find bucket setting for image.uploader.s3")
|
||||
return nil, fmt.Errorf("could not find bucket setting for image.uploader.s3")
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func (u *WebdavUploader) Upload(ctx context.Context, pa string) (string, error)
|
||||
|
||||
if res.StatusCode != http.StatusCreated {
|
||||
body, _ := ioutil.ReadAll(res.Body)
|
||||
return "", fmt.Errorf("Failed to upload image. Returned statuscode %v body %s", res.StatusCode, body)
|
||||
return "", fmt.Errorf("failed to upload image, statuscode: %d, body: %s", res.StatusCode, body)
|
||||
}
|
||||
|
||||
if u.public_url != "" {
|
||||
|
||||
Reference in New Issue
Block a user