Chore: Enable errorlint linter (#29227)

* Enable errorlint linter
* Handle wrapped errors

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
This commit is contained in:
Arve Knudsen
2020-11-19 14:47:17 +01:00
committed by GitHub
parent 993adb72e0
commit 9593d57914
34 changed files with 142 additions and 101 deletions

View File

@@ -45,11 +45,11 @@ func (dc *DatasourceProvisioner) apply(cfg *configs) error {
for _, ds := range cfg.Datasources {
cmd := &models.GetDataSourceByNameQuery{OrgId: ds.OrgID, Name: ds.Name}
err := bus.Dispatch(cmd)
if err != nil && err != models.ErrDataSourceNotFound {
if err != nil && !errors.Is(err, models.ErrDataSourceNotFound) {
return err
}
if err == models.ErrDataSourceNotFound {
if errors.Is(err, models.ErrDataSourceNotFound) {
dc.log.Info("inserting datasource from configuration ", "name", ds.Name, "uid", ds.UID)
insertCmd := createInsertCommand(ds)
if err := bus.Dispatch(insertCmd); err != nil {