@@ -2,18 +2,15 @@ package lint
22
33import (
44 "fmt"
5- "go/ast"
65 "go/build"
76 "go/parser"
8- "go/token"
97 "os"
108 "path/filepath"
119 "strings"
1210 "time"
1311
1412 "github.com/golangci/golangci-lint/pkg/goutils"
1513 "github.com/golangci/golangci-lint/pkg/logutils"
16- "github.com/golangci/golangci-lint/pkg/result/processors"
1714
1815 "github.com/golangci/golangci-lint/pkg/config"
1916 "github.com/golangci/golangci-lint/pkg/lint/astcache"
@@ -260,30 +257,6 @@ func separateNotCompilingPackages(lintCtx *linter.Context) {
260257 }
261258}
262259
263- func removeFakePkgFiles (info * loader.PackageInfo , fset * token.FileSet ) {
264- newFiles := make ([]* ast.File , 0 , len (info .Files ))
265- for _ , f := range info .Files {
266- if ! processors .IsCgoFilename (fset .Position (f .Pos ()).Filename ) {
267- newFiles = append (newFiles , f )
268- }
269- }
270- info .Files = newFiles
271- }
272-
273- func removeFakePackages (prog * loader.Program ) {
274- if prog .Created != nil {
275- for _ , info := range prog .Created {
276- removeFakePkgFiles (info , prog .Fset )
277- }
278- }
279-
280- if prog .Imported != nil {
281- for _ , info := range prog .Imported {
282- removeFakePkgFiles (info , prog .Fset )
283- }
284- }
285- }
286-
287260//nolint:gocyclo
288261func LoadContext (linters []linter.Config , cfg * config.Config , log logutils.Log ) (* linter.Context , error ) {
289262 // Set GOROOT to have working cross-compilation: cross-compiled binaries
@@ -322,11 +295,6 @@ func LoadContext(linters []linter.Config, cfg *config.Config, log logutils.Log)
322295 ssaProg = buildSSAProgram (prog , log )
323296 }
324297
325- if prog != nil {
326- // It's important to do it after SSA building
327- removeFakePackages (prog )
328- }
329-
330298 astLog := log .Child ("astcache" )
331299 var astCache * astcache.Cache
332300 if prog != nil {
0 commit comments