Skip to content

Commit 6a0ddc6

Browse files
authored
fix(cli): only call ResolveFilenames with ProtoImportPaths if specified (#1478)
1 parent 5e8fe24 commit 6a0ddc6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cmd/api-linter/cli.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,12 @@ func (c *cli) lint(rules lint.RuleRegistry, configs lint.Configs) error {
166166
}
167167
// Resolve file absolute paths to relative ones.
168168
// Using supplied import paths first.
169-
protoFiles, err := protoparse.ResolveFilenames(c.ProtoImportPaths, c.ProtoFiles...)
170-
if err != nil {
171-
return err
169+
protoFiles := c.ProtoFiles
170+
if len(c.ProtoImportPaths) > 0 {
171+
protoFiles, err = protoparse.ResolveFilenames(c.ProtoImportPaths, c.ProtoFiles...)
172+
if err != nil {
173+
return err
174+
}
172175
}
173176
// Then resolve again against ".", the local directory.
174177
// This is necessary because ResolveFilenames won't resolve a path if it

0 commit comments

Comments
 (0)