Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/vet: false positive, only okay after go install #16992

Closed
hvnsweeting opened this issue Sep 5, 2016 · 2 comments

Comments

Projects
None yet
5 participants
@hvnsweeting
Copy link

commented Sep 5, 2016

Please answer these questions before submitting your issue. Thanks!

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

go version go1.7 darwin/amd64
and
go version go1.7 linux/amd64

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

$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/hvn/FOSS/gomeo/godeps:/Users/hvn/FOSS/gomeo"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

write a package:

package govetbug

import (
        assert "github.com/stretchr/testify/require"
        "testing"
)

func TestRandomMergeMapBadRatio(t *testing.T) {
        BadRatio := 1
        var err error
        assert.Error(t, err, "Given bad ratio %d not in range (0,100) but function not fail", BadRatio)
}

then run go vet ./...

What did you expect to see?

main.go:11: possible formatting directive in Error call
exit status 1

What did you see instead?

got empty output.

Then if I run

go install .
go vet ./...

it produces expected error output.

Remove /Users/hvn/FOSS/gomeo/godeps/pkg, run go vet ./..., got empty output again.

@0xmohit

This comment has been minimized.

Copy link
Contributor

commented Sep 5, 2016

Related: #16086

@quentinmit quentinmit changed the title go vet false positive, only okay after go install cmd/vet: false positive, only okay after go install Sep 6, 2016

@quentinmit quentinmit added this to the Go1.8Maybe milestone Sep 6, 2016

@griesemer

This comment has been minimized.

Copy link
Contributor

commented Sep 6, 2016

This is for all practical matters a duplicate of #16086. Go vet relies on existing installed packages, even if they are out of date. Closing.

@griesemer griesemer closed this Sep 6, 2016

@golang golang locked and limited conversation to collaborators Sep 6, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.