internal/gofix and fix error wrapping (#76)

This commit is contained in:
T. von Dein
2026-07-07 10:41:34 +02:00
parent f10366dbde
commit b8e0ee074c
28 changed files with 109 additions and 119 deletions

View File

@@ -30,7 +30,7 @@ func RoleNames(conf *cfg.Config) ([]string, error) {
res, err := conf.DefaultCluster.ES().Security.GetRole().
Do(context.Background())
if err != nil {
return nil, fmt.Errorf("failed to get roles: %s", esErrorString(err))
return nil, fmt.Errorf("failed to get roles: %w", esErrorString(err))
}
roles := make([]string, len(res))
@@ -47,7 +47,7 @@ func RoleList(conf *cfg.Config) error {
res, err := conf.DefaultCluster.ES().Security.GetRole().
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to get roles: %s", esErrorString(err))
return fmt.Errorf("failed to get roles: %w", esErrorString(err))
}
slog.Debug("ES result", "roles", res)
@@ -74,7 +74,7 @@ func RoleShow(conf *cfg.Config, rolename string) error {
Name(rolename).
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to get role: %s", esErrorString(err))
return fmt.Errorf("failed to get role: %w", esErrorString(err))
}
slog.Debug("ES result", "role", res)