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: Go vet misses error when running in shell and not Makefile #21688

Closed
abraithwaite opened this issue Aug 30, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@abraithwaite
Copy link
Contributor

commented Aug 30, 2017

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

Tested on:

16:56:48 $ go version
go version go1.8.3 darwin/amd64

and

16:56:38 $ go version
go version go1.9 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

16:57:29 $ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/abraithwaite/Projects/golang"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.8.3/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.8.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/cw/g070lvlx10v7lt_wtqd_6hr00000gn/T/go-build007718187=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

Additionally, I'm running in ZSH, although the issue isn't caught in bash either.

What did you do?

Trying to reproduce in a pruned makefile I couldn't reproduce it. I'll see about cleaning up the actual makefile which reproduces the issue.

16:57:58 $ make
go version go1.8.3 darwin/amd64
/usr/local/Cellar/go/1.8.3/libexec/pkg/tool/darwin_amd64/vet types.go
/usr/local/Cellar/go/1.8.3/libexec/pkg/tool/darwin_amd64/vet cmd/quotes/main.go
/usr/local/Cellar/go/1.8.3/libexec/pkg/tool/darwin_amd64/vet internal/memory/memory.go
# github.com/segmentio/quotes/internal/memory
internal/memory/memory.go:44: n declared and not used
make: *** [build] Error 2

17:01:43 $ /usr/local/Cellar/go/1.8.3/libexec/pkg/tool/darwin_amd64/vet internal/memory/memory.go
17:01:45 $ echo $?
0
17:02:31 $ go vet ./...
17:02:33 $ echo $?
0
17:02:35 $ grep vet Makefile
        $Qgo vet -x ./...

What did you expect to see?

Vet catch the error running from the command line.

What did you see instead?

Vet doesn't catch the error from the command line.

I'll continue to try to reproduce in different environments / in isolation so it can hopefully be reproduced by others. Otherwise, I'll just continue to go insane. :-)

Lemme know if there's anything easy I can do to get more visibility into the program, before I dig too deeply into it.

@mvdan

This comment has been minimized.

Copy link
Member

commented Aug 30, 2017

Note that pkg/tool/.../vet may not be the same as go vet. Have you tried with go tool vet? I believe that would be the short equivalent.

@abraithwaite

This comment has been minimized.

Copy link
Contributor Author

commented Aug 30, 2017

I did try with go tool vet.

abraithwaite at alan-mbpr in ~GOPATH/src/github.com/segmentio/quotes (master)
07:53:11 $ go tool vet internal/memory/memory.go
abraithwaite at alan-mbpr in ~GOPATH/src/github.com/segmentio/quotes (master)
07:53:16 $ echo $?
0
abraithwaite at alan-mbpr in ~GOPATH/src/github.com/segmentio/quotes (master)
07:53:33 $ make
go version go1.8.3 darwin/amd64
/usr/local/Cellar/go/1.8.3/libexec/pkg/tool/darwin_amd64/vet types.go
/usr/local/Cellar/go/1.8.3/libexec/pkg/tool/darwin_amd64/vet cmd/quotes/main.go
/usr/local/Cellar/go/1.8.3/libexec/pkg/tool/darwin_amd64/vet internal/memory/memory.go
# github.com/segmentio/quotes/internal/memory
internal/memory/memory.go:44: n declared and not used
make: *** [build] Error 2

@ianlancetaylor ianlancetaylor changed the title Go vet misses error when running in shell and not Makefile cmd/vet: Go vet misses error when running in shell and not Makefile Aug 30, 2017

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Aug 30, 2017

We need to see the exact commands and input files to reproduce the problem. It's extremely unlikely that it has anything to do with being run from a Makefile. It's much more likely that it has to do with exactly how the Makefile runs the command.

@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Aug 30, 2017

@abraithwaite

This comment has been minimized.

Copy link
Contributor Author

commented Aug 30, 2017

I'm a total dunce. It's the go build output that I'm seeing, not the go vet output.

Thanks @ianlancetaylor

@golang golang locked and limited conversation to collaborators Aug 30, 2018

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.