Load AST for fast linters in different way.

Use build.Import instead of manual parser.ParseFile and paths traversal. It allows:
1. support build tags for all linters.
2. analyze files only for current GOOS/GOARCH: less false-positives.
3. analyze xtest packages (*_test) by golint: upstream golint and
gometalinter can't do it! And don't break analysis on the first xtest
package like it was before.
4. proper handling of xtest packages for linters like goconst where
package boundary is important: less false-positives is expected.

Also:
1. reuse AST parsing for golint and goconst: minor speedup.
2. allow to specify path (not only name) regexp for --skip-files and
--skip-dirs
3. add more default exclude filters for golint about commits:
`(comment on exported (method|function)|should have( a package)?
    comment|comment should be of the form)`
4. print skipped dir in verbose (-v) mode
5. refactor per-linter tests: declare arguments in comments, run only
one linter and in combination with slow linter
This commit is contained in:
Denis Isaev 2018-06-10 17:10:56 +03:00
parent f5a9bbb140
commit 2b587b63d6
No known key found for this signature in database
GPG key ID: A36A0EC8E27A1A01
59 changed files with 755 additions and 512 deletions

12
pkg/timeutils/track.go Normal file
View file

@ -0,0 +1,12 @@
package timeutils
import (
"fmt"
"time"
"github.com/sirupsen/logrus"
)
func Track(from time.Time, format string, args ...interface{}) {
logrus.Infof("%s took %s", fmt.Sprintf(format, args...), time.Since(from))
}