dev: fix linter tests (#3128)

This commit is contained in:
Ludovic Fernandez 2022-08-23 10:33:57 +02:00 committed by GitHub
parent f48530e25e
commit 77962e9283
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -61,7 +61,7 @@ func testSourcesFromDir(t *testing.T, dir string) {
t.Run(filepath.Base(source), func(subTest *testing.T) {
subTest.Parallel()
rel, err := filepath.Rel(dir, sources[0])
rel, err := filepath.Rel(dir, source)
require.NoError(t, err)
testOneSource(subTest, log, binPath, rel)

View File

@ -104,7 +104,17 @@ func (b *RunnerBuilder) WithRunContext(rc *RunContext) *RunnerBuilder {
return b
}
return b.WithConfigFile(rc.ConfigPath).WithArgs(rc.Args...)
dir, err := os.Getwd()
require.NoError(b.tb, err)
configPath := filepath.FromSlash(rc.ConfigPath)
base := filepath.Base(dir)
if strings.HasPrefix(configPath, base) {
configPath = strings.TrimPrefix(configPath, base+string(filepath.Separator))
}
return b.WithConfigFile(configPath).WithArgs(rc.Args...)
}
func (b *RunnerBuilder) WithDirectives(sourcePath string) *RunnerBuilder {