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

@@ -29,7 +29,7 @@ func getRemoteName(conf *cfg.Config) (string, error) {
res, err := conf.DefaultCluster.ES().Cluster.RemoteInfo().
Do(context.Background())
if err != nil {
return "", fmt.Errorf("failed to retrieve follower info: %s", esErrorString(err))
return "", fmt.Errorf("failed to retrieve follower info: %w", esErrorString(err))
}
remote := ""
@@ -91,7 +91,7 @@ func CcrFollowerResume(conf *cfg.Config, index string) error {
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to resume ccr following: %s", esErrorString(err))
return fmt.Errorf("failed to resume ccr following: %w", esErrorString(err))
}
return nil
@@ -102,7 +102,7 @@ func CcrFollowerPause(conf *cfg.Config, index string) error {
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to pause ccr following: %s", esErrorString(err))
return fmt.Errorf("failed to pause ccr following: %w", esErrorString(err))
}
return nil
@@ -113,7 +113,7 @@ func CcrFollowerUnfollow(conf *cfg.Config, index string) error {
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to unfollow index: %s", esErrorString(err))
return fmt.Errorf("failed to unfollow index: %w", esErrorString(err))
}
return nil
@@ -136,7 +136,7 @@ func CcrFollowerAdd(conf *cfg.Config, index string) error {
_, err = create.Do(context.Background())
if err != nil {
return fmt.Errorf("failed to create follower index: %s", esErrorString(err))
return fmt.Errorf("failed to create follower index: %w", esErrorString(err))
}
return nil
@@ -146,7 +146,7 @@ func CcrFollowerShow(conf *cfg.Config, index string) error {
res, err := conf.DefaultCluster.ES().Ccr.FollowStats(index).
Do(context.Background())
if err != nil {
return fmt.Errorf("failed to retrieve follower index info: %s", esErrorString(err))
return fmt.Errorf("failed to retrieve follower index info: %w", esErrorString(err))
}
slog.Debug("ES result", "follower stats", res.Indices)