mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Remove Wrapf (#50128)
* Chore: Remove Wrapf * Remove all Wrapf refs * Remove last Wrapf ref * Fix lint errors * Remove Wrap and Wrapf definitions * Remove unnecessary colon
This commit is contained in:
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/errutil"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -72,11 +71,14 @@ func migrateColumn(session *sqlstore.DBSession, column string) (int, error) {
|
||||
err := session.Find(&rows)
|
||||
|
||||
if err != nil {
|
||||
return 0, errutil.Wrapf(err, "failed to select column: %s", column)
|
||||
return 0, fmt.Errorf("failed to select column: %s: %w", column, err)
|
||||
}
|
||||
|
||||
rowsUpdated, err := updateRows(session, rows, column)
|
||||
return rowsUpdated, errutil.Wrapf(err, "failed to update column: %s", column)
|
||||
if err != nil {
|
||||
return rowsUpdated, fmt.Errorf("failed to update column: %s: %w", column, err)
|
||||
}
|
||||
return rowsUpdated, err
|
||||
}
|
||||
|
||||
func updateRows(session *sqlstore.DBSession, rows []map[string][]byte, passwordFieldName string) (int, error) {
|
||||
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
|
||||
"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/installer"
|
||||
"github.com/grafana/grafana/pkg/util/errutil"
|
||||
|
||||
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
|
||||
)
|
||||
@@ -147,7 +146,7 @@ func InstallPlugin(pluginName, version string, c utils.CommandLine, client utils
|
||||
res, _ := services.ReadPlugin(pluginFolder, pluginName)
|
||||
for _, v := range res.Dependencies.Plugins {
|
||||
if err := InstallPlugin(v.ID, "", c, client); err != nil {
|
||||
return errutil.Wrapf(err, "failed to install plugin '%s'", v.ID)
|
||||
return fmt.Errorf("failed to install plugin '%s': %w", v.ID, err)
|
||||
}
|
||||
|
||||
logger.Infof("Installed dependency: %v ✔\n", v.ID)
|
||||
@@ -313,7 +312,7 @@ func extractSymlink(file *zip.File, filePath string) error {
|
||||
return fmt.Errorf("%v: %w", "failed to copy symlink contents", err)
|
||||
}
|
||||
if err := os.Symlink(strings.TrimSpace(buf.String()), filePath); err != nil {
|
||||
return errutil.Wrapf(err, "failed to make symbolic link for %v", filePath)
|
||||
return fmt.Errorf("failed to make symbolic link for %v: %w", filePath, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/errutil"
|
||||
)
|
||||
|
||||
const AdminUserId = 1
|
||||
@@ -57,7 +56,7 @@ func resetPasswordCommand(c utils.CommandLine, sqlStore *sqlstore.SQLStore) erro
|
||||
}
|
||||
|
||||
if err := sqlStore.ChangeUserPassword(context.Background(), &cmd); err != nil {
|
||||
return errutil.Wrapf(err, "failed to update user password")
|
||||
return fmt.Errorf("failed to update user password: %w", err)
|
||||
}
|
||||
|
||||
logger.Infof("\n")
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
|
||||
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
|
||||
"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
|
||||
"github.com/grafana/grafana/pkg/util/errutil"
|
||||
)
|
||||
|
||||
func (cmd Command) upgradeCommand(c utils.CommandLine) error {
|
||||
@@ -25,7 +26,7 @@ func (cmd Command) upgradeCommand(c utils.CommandLine) error {
|
||||
|
||||
if shouldUpgrade(localPlugin.Info.Version, &plugin) {
|
||||
if err := services.RemoveInstalledPlugin(pluginsDir, pluginName); err != nil {
|
||||
return errutil.Wrapf(err, "failed to remove plugin '%s'", pluginName)
|
||||
return fmt.Errorf("failed to remove plugin '%s': %w", pluginName, err)
|
||||
}
|
||||
|
||||
return InstallPlugin(pluginName, "", c, cmd.Client)
|
||||
|
||||
Reference in New Issue
Block a user