Skip to content

cmd/vet: go vet failing on directory with no non-test files #23395

@campoy

Description

@campoy

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

go version devel +23aefcd9ae Wed Jan 10 00:00:40 2018 +0000 darwin/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64" GOBIN="" GOCACHE="/Users/francesc/Library/Caches/go-build" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/francesc" GORACE="" GOROOT="/Users/francesc/go" GOTMPDIR="" GOTOOLDIR="/Users/francesc/go/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/tm/816df9c9399_1fnz90k6gfq80000gn/T/go-build262771710=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

As part of my continuous build steps I run go vet on all my code.
In order to do this I used to run go list ./... | grep -v vendor | xargs go vet.

Until go1.9 this was working correctly but as you can see here it stopped working with go1.10.

What did you expect to see?

Running go vet in a directory with only the the test below should give a go vet warning.

package main_test

import (
	"fmt"
	"testing"
)

func TestSomething(t *testing.T) {
	fmt.Printf("Something missing %s")
}
$ go vet
main_test.go:9: missing argument for Printf("%s"): format reads arg 1, have only 0 args
exit status 1

What did you see instead?

The output is not a warning, but an error to load the package.

$ go vet
go build github.com/campoy/test/foo: no non-test Go files in .../foo

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions