Fix #122: don't crash govet on tests-only packages
This commit is contained in:
parent
ebbfc26e88
commit
93311aee9b
@ -7,6 +7,7 @@ script: make check_generated test
|
||||
|
||||
after_success:
|
||||
- test -n "$TRAVIS_TAG" && docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
||||
- echo "travis go version='$TRAVIS_GO_VERSION'"
|
||||
|
||||
# needed for the docker pipe
|
||||
services:
|
||||
@ -18,4 +19,4 @@ deploy:
|
||||
script: curl -sL https://git.io/goreleaser | bash
|
||||
on:
|
||||
tags: true
|
||||
condition: $TRAVIS_GO_VERSION =~ ^1\.10\.[0-9]+$
|
||||
condition: $TRAVIS_GO_VERSION =~ ^1\.10\.
|
||||
|
@ -76,6 +76,9 @@ func (g Govet) runOnInstalledPackages(ctx context.Context, lintCtx *linter.Conte
|
||||
astFiles = append(astFiles, af.F)
|
||||
fset = af.Fset
|
||||
}
|
||||
if len(astFiles) == 0 {
|
||||
continue
|
||||
}
|
||||
issues, err := govetAPI.Analyze(astFiles, fset, nil,
|
||||
lintCtx.Settings().Govet.CheckShadowing)
|
||||
if err != nil {
|
||||
@ -216,6 +219,9 @@ func (g Govet) runOnSourcePackages(ctx context.Context, lintCtx *linter.Context)
|
||||
// TODO: check .S asm files: govet can do it if pass dirs
|
||||
var govetIssues []govetAPI.Issue
|
||||
for _, pkg := range lintCtx.Program.InitialPackages() {
|
||||
if len(pkg.Files) == 0 {
|
||||
continue
|
||||
}
|
||||
issues, err := govetAPI.Analyze(pkg.Files, lintCtx.Program.Fset, pkg,
|
||||
lintCtx.Settings().Govet.CheckShadowing)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user