@@ -10,11 +10,11 @@ import (
10
10
"strings"
11
11
"time"
12
12
13
+ "github.com/golangci/golangci-lint/pkg/fsutils"
13
14
"github.com/golangci/golangci-lint/pkg/goutils"
14
15
"github.com/golangci/golangci-lint/pkg/lint/linter"
15
16
"github.com/golangci/golangci-lint/pkg/logutils"
16
17
"github.com/golangci/golangci-lint/pkg/result"
17
- "github.com/golangci/golangci-lint/pkg/result/processors"
18
18
"github.com/golangci/golangci-lint/pkg/timeutils"
19
19
govetAPI "github.com/golangci/govet"
20
20
)
@@ -82,7 +82,7 @@ func (g Govet) runOnInstalledPackages(ctx context.Context, lintCtx *linter.Conte
82
82
continue
83
83
}
84
84
issues , err := govetAPI .Analyze (astFiles , fset , nil ,
85
- lintCtx .Settings ().Govet .CheckShadowing )
85
+ lintCtx .Settings ().Govet .CheckShadowing , getPath )
86
86
if err != nil {
87
87
return nil , err
88
88
}
@@ -220,7 +220,7 @@ func runGoCommand(ctx context.Context, log logutils.Log, args ...string) error {
220
220
func filterFiles (files []* ast.File , fset * token.FileSet ) []* ast.File {
221
221
newFiles := make ([]* ast.File , 0 , len (files ))
222
222
for _ , f := range files {
223
- if ! processors .IsCgoFilename (fset .Position (f .Pos ()).Filename ) {
223
+ if ! goutils .IsCgoFilename (fset .Position (f .Pos ()).Filename ) {
224
224
newFiles = append (newFiles , f )
225
225
}
226
226
}
@@ -238,7 +238,7 @@ func (g Govet) runOnSourcePackages(_ context.Context, lintCtx *linter.Context) (
238
238
239
239
filteredFiles := filterFiles (pkg .Files , lintCtx .Program .Fset )
240
240
issues , err := govetAPI .Analyze (filteredFiles , lintCtx .Program .Fset , pkg ,
241
- lintCtx .Settings ().Govet .CheckShadowing )
241
+ lintCtx .Settings ().Govet .CheckShadowing , getPath )
242
242
if err != nil {
243
243
return nil , err
244
244
}
@@ -247,3 +247,7 @@ func (g Govet) runOnSourcePackages(_ context.Context, lintCtx *linter.Context) (
247
247
248
248
return govetIssues , nil
249
249
}
250
+
251
+ func getPath (f * ast.File , fset * token.FileSet ) (string , error ) {
252
+ return fsutils .ShortestRelPath (fset .Position (f .Pos ()).Filename , "" )
253
+ }
0 commit comments