From 752841d213c12c8a6cff3caef6be4f7e779c9f7a Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 8 Dec 2020 15:20:13 +0100 Subject: [PATCH] cleanup: standardize error format in util.readClusterInfo() Signed-off-by: Niels de Vos --- internal/util/csiconfig.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/util/csiconfig.go b/internal/util/csiconfig.go index fee2f6cfa..10e05e6e1 100644 --- a/internal/util/csiconfig.go +++ b/internal/util/csiconfig.go @@ -71,13 +71,13 @@ func readClusterInfo(pathToConfig, clusterID string) (*ClusterInfo, error) { // #nosec content, err := ioutil.ReadFile(pathToConfig) if err != nil { - err = fmt.Errorf("error fetching configuration for cluster ID (%s). (%s)", clusterID, err) + err = fmt.Errorf("error fetching configuration for cluster ID %q: %w", clusterID, err) return nil, err } err = json.Unmarshal(content, &config) if err != nil { - return nil, fmt.Errorf("unmarshal failed: %v. raw buffer response: %s", + return nil, fmt.Errorf("unmarshal failed (%w), raw buffer response: %s", err, string(content)) } @@ -87,7 +87,7 @@ func readClusterInfo(pathToConfig, clusterID string) (*ClusterInfo, error) { } } - return nil, fmt.Errorf("missing configuration for cluster ID (%s)", clusterID) + return nil, fmt.Errorf("missing configuration for cluster ID %q", clusterID) } // Mons returns a comma separated MON list from the csi config for the given clusterID.