From 6127a300cf50183a490f982fb8d7ea97504e898b Mon Sep 17 00:00:00 2001 From: David Laubreiter Date: Mon, 25 Sep 2023 15:24:08 +0200 Subject: [PATCH] fix: Fix error formatting of path %q does not only quote the variable's content, but also makes it 'safe'. It's not clearly defined in the golang docs, but backslashes are escaped as well. To properly render the error, we need to quote the string ourselves and print the string using %s --- pkg/config/template/filebased.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/template/filebased.go b/pkg/config/template/filebased.go index cc900be6d8..21fcc6e9bb 100644 --- a/pkg/config/template/filebased.go +++ b/pkg/config/template/filebased.go @@ -71,7 +71,7 @@ func NewFileTemplate(fs afero.Fs, path string) (Template, error) { if exists, err := afero.Exists(fs, sanitizedPath); err != nil { return nil, fmt.Errorf("failed to load template: %w", err) } else if !exists { - return nil, fmt.Errorf("template file %q does not exist", sanitizedPath) + return nil, fmt.Errorf(`template file "%s" does not exist`, sanitizedPath) } template := FileBasedTemplate{