From 8b81a99108b6c80ceb97c502fbcd5b4c89f7ca17 Mon Sep 17 00:00:00 2001 From: Junduo Dong Date: Fri, 3 Nov 2023 14:33:45 +0000 Subject: [PATCH] contrib: correct parameter name Signed-off-by: Junduo Dong --- contrib/nydusify/cmd/nydusify.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/contrib/nydusify/cmd/nydusify.go b/contrib/nydusify/cmd/nydusify.go index 66aa774de85..8ae38f434fb 100644 --- a/contrib/nydusify/cmd/nydusify.go +++ b/contrib/nydusify/cmd/nydusify.go @@ -69,27 +69,27 @@ func parseBackendConfig(backendConfigJSON, backendConfigFile string) (string, er return backendConfigJSON, nil } -func getBackendConfig(c *cli.Context, suffix string, required bool) (string, string, error) { - backendType := c.String(suffix + "backend-type") +func getBackendConfig(c *cli.Context, prefix string, required bool) (string, string, error) { + backendType := c.String(prefix + "backend-type") if backendType == "" { if required { - return "", "", errors.Errorf("backend type is empty, please specify option '--%sbackend-type'", suffix) + return "", "", errors.Errorf("backend type is empty, please specify option '--%sbackend-type'", prefix) } return "", "", nil } possibleBackendTypes := []string{"oss", "s3"} if !isPossibleValue(possibleBackendTypes, backendType) { - return "", "", fmt.Errorf("--%sbackend-type should be one of %v", suffix, possibleBackendTypes) + return "", "", fmt.Errorf("--%sbackend-type should be one of %v", prefix, possibleBackendTypes) } backendConfig, err := parseBackendConfig( - c.String(suffix+"backend-config"), c.String(suffix+"backend-config-file"), + c.String(prefix+"backend-config"), c.String(prefix+"backend-config-file"), ) if err != nil { return "", "", err } else if (backendType == "oss" || backendType == "s3") && strings.TrimSpace(backendConfig) == "" { - return "", "", errors.Errorf("backend configuration is empty, please specify option '--%sbackend-config'", suffix) + return "", "", errors.Errorf("backend configuration is empty, please specify option '--%sbackend-config'", prefix) } return backendType, backendConfig, nil