Skip to content

Commit 685eb4a

Browse files
committed
Use %s instead of %q in the invalid-image-spec error
The operator emits logs as JSON; %q double-escapes the quoted strings (\"<string>\"), so %s keeps the field values readable. Signed-off-by: Abrar Shivani <ashivani@nvidia.com>
1 parent 4c09df4 commit 685eb4a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎api/nvidia/v1/clusterpolicy_types.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ func imagePath(repository string, image string, version string, imagePathEnvName
20622062
}
20632063
} else {
20642064
if repository == "" || image == "" {
2065-
return "", fmt.Errorf("invalid image specification: both repository and image must be set (repository=%q, image=%q, version=%q)", repository, image, version)
2065+
return "", fmt.Errorf("invalid image specification: both repository and image must be set (repository=%s, image=%s, version=%s)", repository, image, version)
20662066
}
20672067
// use @ if image digest is specified instead of tag
20682068
if strings.HasPrefix(version, "sha256:") {

‎internal/image/image.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func ImagePath(repository string, image string, version string, imagePathEnvName
3333
}
3434
} else {
3535
if repository == "" || image == "" {
36-
return "", fmt.Errorf("invalid image specification: both repository and image must be set (repository=%q, image=%q, version=%q)", repository, image, version)
36+
return "", fmt.Errorf("invalid image specification: both repository and image must be set (repository=%s, image=%s, version=%s)", repository, image, version)
3737
}
3838
// use @ if image digest is specified instead of tag
3939
if strings.HasPrefix(version, "sha256:") {

0 commit comments

Comments
 (0)