Skip to content

Commit 8987b09

Browse files
authored
fix: replace raw %s with %#q (#56)
1 parent 2790f9f commit 8987b09

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

internal/app/azldev/core/components/resolver.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (r *Resolver) FindComponentsByNamePattern(pattern string) (components *Comp
150150

151151
matched, err = filepath.Match(pattern, name)
152152
if err != nil {
153-
return components, fmt.Errorf("failed to compare component pattern '%s':\n%w", pattern, err)
153+
return components, fmt.Errorf("failed to compare component pattern %#q:\n%w", pattern, err)
154154
}
155155

156156
if matched {
@@ -162,7 +162,7 @@ func (r *Resolver) FindComponentsByNamePattern(pattern string) (components *Comp
162162
// Otherwise, look for the exact match.
163163
component, ok := allComponents.TryGet(pattern)
164164
if !ok {
165-
return components, fmt.Errorf("component not found: %s", pattern)
165+
return components, fmt.Errorf("component not found: %#q", pattern)
166166
}
167167

168168
components.Add(component)
@@ -184,7 +184,7 @@ func (r *Resolver) GetComponentByName(name string) (component Component, err err
184184
// Lookup the exact name.
185185
var ok bool
186186
if component, ok = allComponents.TryGet(name); !ok {
187-
return component, fmt.Errorf("component not found: %s", name)
187+
return component, fmt.Errorf("component not found: %#q", name)
188188
}
189189

190190
return component, nil
@@ -199,7 +199,7 @@ func (r *Resolver) GetComponentGroupByName(componentGroupName string) (component
199199

200200
// Look in our loaded configuration for a group with the given name.
201201
if componentGroupConfig, ok = r.env.Config().ComponentGroups[componentGroupName]; !ok {
202-
err = fmt.Errorf("%w: %s", ErrComponentGroupNotFound, componentGroupName)
202+
err = fmt.Errorf("%w: %#q", ErrComponentGroupNotFound, componentGroupName)
203203

204204
return componentGroup, err
205205
}
@@ -268,7 +268,7 @@ func findComponentGroupSpecPaths(
268268
// directories).
269269
currentMatches, err = fileutils.Glob(env.FS(), pattern, doublestar.WithFilesOnly())
270270
if err != nil {
271-
return matches, fmt.Errorf("failed to expand spec pattern '%s':\n%w", pattern, err)
271+
return matches, fmt.Errorf("failed to expand spec pattern %#q:\n%w", pattern, err)
272272
}
273273

274274
for _, match := range currentMatches {
@@ -297,7 +297,7 @@ func componentGroupExcludesSpec(
297297
matched, err := doublestar.PathMatch(excludePattern, specPath)
298298
if err != nil {
299299
return false, fmt.Errorf(
300-
"failed to compare '%s' against exclude pattern '%s':\n%w", specPath, excludePattern, err)
300+
"failed to compare %#q against exclude pattern %#q:\n%w", specPath, excludePattern, err)
301301
}
302302

303303
if matched {
@@ -414,7 +414,7 @@ func (r *Resolver) getComponentFromNameAndSpecPath(name, specPath string) (compo
414414
if !found {
415415
// If we didn't find it *and* if we don't have a spec path, then we need to return error.
416416
if specPath == "" {
417-
return component, fmt.Errorf("component config not found: %s", name)
417+
return component, fmt.Errorf("component config not found: %#q", name)
418418
}
419419

420420
// Otherwise, we'll synthesize an empty component config.

0 commit comments

Comments
 (0)