@@ -2,18 +2,15 @@ package lint
2
2
3
3
import (
4
4
"fmt"
5
- "go/ast"
6
5
"go/build"
7
6
"go/parser"
8
- "go/token"
9
7
"os"
10
8
"path/filepath"
11
9
"strings"
12
10
"time"
13
11
14
12
"github.com/golangci/golangci-lint/pkg/goutils"
15
13
"github.com/golangci/golangci-lint/pkg/logutils"
16
- "github.com/golangci/golangci-lint/pkg/result/processors"
17
14
18
15
"github.com/golangci/golangci-lint/pkg/config"
19
16
"github.com/golangci/golangci-lint/pkg/lint/astcache"
@@ -260,30 +257,6 @@ func separateNotCompilingPackages(lintCtx *linter.Context) {
260
257
}
261
258
}
262
259
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
-
287
260
//nolint:gocyclo
288
261
func LoadContext (linters []linter.Config , cfg * config.Config , log logutils.Log ) (* linter.Context , error ) {
289
262
// 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)
322
295
ssaProg = buildSSAProgram (prog , log )
323
296
}
324
297
325
- if prog != nil {
326
- // It's important to do it after SSA building
327
- removeFakePackages (prog )
328
- }
329
-
330
298
astLog := log .Child ("astcache" )
331
299
var astCache * astcache.Cache
332
300
if prog != nil {
0 commit comments