From f23fd2ce38ee3a9e87ac41c265b637cf97990ac7 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 4 Dec 2023 23:13:42 +0100 Subject: [PATCH] Fix double error wrap fmt Signed-off-by: Evan Lezar --- cmd/nvidia-ctk/config/config.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/nvidia-ctk/config/config.go b/cmd/nvidia-ctk/config/config.go index 3f10f727..5a21b688 100644 --- a/cmd/nvidia-ctk/config/config.go +++ b/cmd/nvidia-ctk/config/config.go @@ -17,7 +17,6 @@ package config import ( - "errors" "fmt" "reflect" "strconv" @@ -28,6 +27,7 @@ import ( createdefault "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/config/create-default" "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk/config/flags" "github.com/NVIDIA/nvidia-container-toolkit/internal/config" + "github.com/NVIDIA/nvidia-container-toolkit/internal/errors" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" ) @@ -141,7 +141,7 @@ func setFlagToKeyValue(setFlag string) (string, interface{}, error) { field, err := getField(key) if err != nil { - return key, nil, fmt.Errorf("%w: %w", errInvalidConfigOption, err) + return key, nil, errors.Join(err, errInvalidConfigOption) } kind := field.Kind() @@ -157,7 +157,7 @@ func setFlagToKeyValue(setFlag string) (string, interface{}, error) { case reflect.Bool: b, err := strconv.ParseBool(value) if err != nil { - return key, value, fmt.Errorf("%w: %w", errInvalidFormat, err) + return key, value, errors.Join(err, errInvalidFormat) } return key, b, err case reflect.String: @@ -172,7 +172,7 @@ func setFlagToKeyValue(setFlag string) (string, interface{}, error) { for _, v := range valueParts { vi, err := strconv.ParseInt(v, 10, 0) if err != nil { - return key, nil, fmt.Errorf("%w: %w", errInvalidFormat, err) + return key, nil, errors.Join(err, errInvalidFormat) } output = append(output, vi) }