Skip to content

cmd/vet: bombs out before reporting all errors #31619

Description

@davecheney

What version of Go are you using (go version)?

% go version
go version devel +68d4b1265e Sat Apr 20 19:34:03 2019 +0000 darwin/amd64

Does this issue reproduce with the latest release?

yes

What did you do?

(~/devel/vet) % ls
go.mod          go.sum          tools.go
(~/devel/vet) % cat go.mod
module github.com/davecheney/vetbug

go 1.13

require mvdan.cc/unparam v0.0.0-20190310220240-1b9ccfa71afe
(~/devel/vet) % cat tools.go 
// +build tools
package main

import _ "mvdan.cc/unparam"

What did you expect to see?

% go vet
# github.com/davecheney/vetbug
./tools.go:1:1: +build comment must appear before package clause and be followed by a blank line
tools.go:4:8: import "mvdan.cc/unparam" is a program, not an importable package

What did you see instead?

(~/devel/vet) % go vet
tools.go:4:8: import "mvdan.cc/unparam" is a program, not an importable package

The failure to report the incorrect build tag on line 1 is masked by the complaint about the non importable package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AnalysisIssues related to static analysis (vet, x/tools/go/analysis)NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions