Luke Shumaker e87a1cfb83 Fix a false-positive from 'unused' (#585)
This false-positive is not present in the upstream stand-alone 'unused'
2019.1.1 program that golangci-lint uses.

pkg/lint.ContextLoader.filterPackages() did two things:
 1. It removed synthetic "testmain" packages (packages with .Name=="main"
    and .PkgPath ending with ".test")
 2. It removed pruned subsumed copies of packages; if a package with files
    "a.go" and "a_test.go", it results in packages.Load giving us two
    packages:
      - ID=".../a" GoFiles=[a.go]
      - ID=".../a [.../a.test]" GoFiles=[a.go a_test.go]
    The first package is subsumed in the second, and leaving it around
    results in duplicated work, and confuses the 'deadcode' linter.

However, the 'unused' linter relies on both the ".../a" and
".../a [.../a.test]" packages being present.  Pruning them causes it to
panic in some situations, which lead to this workaround:
af6baa5dc1

While that workaround got it to not panic, it causes incorrect results.

So, split filterPackages() in to two functions: filterTestMainPackages()
and filterDuplicatePackages().  The linter.Context.Packages list only
gets filterTestMainPackages() called on it, while linter.Context.Program
and linter.Context.SSAProgram get both filters applied.

With the source of the panic fixed, roll back a few now-unnecessary
commits in go-tools.
2019-09-09 16:10:49 +03:00
..
2019-02-11 09:43:23 +03:00
2018-05-05 17:00:56 +03:00
2019-01-09 09:51:48 +03:00
2018-05-15 09:07:27 +03:00
2018-05-05 17:00:56 +03:00
2018-05-07 14:02:27 +03:00
2019-06-18 22:24:38 +03:00
2018-05-05 17:00:56 +03:00
2018-05-22 22:43:47 +03:00
2018-05-05 17:00:56 +03:00
2018-11-07 09:11:08 +03:00
2018-05-15 09:07:27 +03:00
2019-02-11 09:43:23 +03:00