Skip to content

Commit

Permalink
fix: Fix error formatting of path
Browse files Browse the repository at this point in the history
%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
  • Loading branch information
Laubi committed Sep 25, 2023
1 parent a12b5af commit 6127a30
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/config/template/filebased.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 6127a30

Please sign in to comment.