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 syscall doesn't show anything whereas go tool vet pkg/syscall shows a warning #8511

Closed
minux opened this issue Aug 11, 2014 · 10 comments
Milestone

Comments

@minux
Copy link
Member

minux commented Aug 11, 2014

$ go version
go version devel +0449858880be Mon Aug 11 17:11:31 2014 -0400 linux/amd64
$ go get -u -a code.google.com/p/go.tools/cmd/vet
$ go vet syscall
$ go vet -x syscall
../pkg/tool/linux_amd64/vet pkg/syscall/creds_test.go pkg/syscall/env_unix.go
pkg/syscall/exec_linux.go pkg/syscall/exec_unix.go pkg/syscall/flock.go
pkg/syscall/lsf_linux.go pkg/syscall/mmap_unix_test.go pkg/syscall/netlink_linux.go
pkg/syscall/race0.go pkg/syscall/sockcmsg_linux.go pkg/syscall/sockcmsg_unix.go
pkg/syscall/str.go pkg/syscall/syscall.go pkg/syscall/syscall_linux.go
pkg/syscall/syscall_linux_amd64.go pkg/syscall/syscall_test.go
pkg/syscall/syscall_unix.go pkg/syscall/syscall_unix_test.go
pkg/syscall/zerrors_linux_amd64.go pkg/syscall/zsyscall_linux_amd64.go
pkg/syscall/zsysnum_linux_amd64.go pkg/syscall/ztypes_linux_amd64.go
pkg/syscall/asm_linux_amd64.s
$ ../pkg/tool/linux_amd64/vet pkg/syscall/creds_test.go pkg/syscall/env_unix.go
pkg/syscall/exec_linux.go pkg/syscall/exec_unix.go pkg/syscall/flock.go
pkg/syscall/lsf_linux.go pkg/syscall/mmap_unix_test.go pkg/syscall/netlink_linux.go
pkg/syscall/race0.go pkg/syscall/sockcmsg_linux.go pkg/syscall/sockcmsg_unix.go
pkg/syscall/str.go pkg/syscall/syscall.go pkg/syscall/syscall_linux.go
pkg/syscall/syscall_linux_amd64.go pkg/syscall/syscall_test.go
pkg/syscall/syscall_unix.go pkg/syscall/syscall_unix_test.go
pkg/syscall/zerrors_linux_amd64.go pkg/syscall/zsyscall_linux_amd64.go
pkg/syscall/zsysnum_linux_amd64.go pkg/syscall/ztypes_linux_amd64.go
pkg/syscall/asm_linux_amd64.s
$ ../pkg/tool/linux_amd64/vet syscall
vet: error walking tree: stat syscall: no such file or directory
vet: syscall: open syscall: no such file or directory
vet: no files checked
$ ../pkg/tool/linux_amd64/vet pkg/syscall
pkg/syscall/sockcmsg_unix.go:82: possible misuse of unsafe.Pointer
$ (cd ~/src/code.google.com/p/go.tools/; hg sum)
parent: 1035:35238aaf7394 tip
 go.tools/go/ssa: improvements to CreateTestMainPackage.
branch: default
commit: 1 unknown (clean)
update: (current)


I also tried go1.3 with vet from release-branch.go1.3 package.
It's the same.

And with our official 1.3 binary.
$ wget http://golang.org/dl/go1.3.linux-amd64.tar.gz
$ tar xf go1.3.linux-amd64.tar.gz
$ cd go
$ GOROOT=`pwd` bin/go vet syscall
$ GOROOT=`pwd` bin/go tool vet src/pkg/syscall
src/pkg/syscall/sockcmsg_unix.go:82: possible misuse of unsafe.Pointer

It's because there is a difference between vet on Darwin and Linux?

Originated from the discussion "[golang-dev] proposal: unsafe.Pointer arithmetic
rules".
Tentatively marked Go 1.3.1 as go1.3 also suffered from this (at least on linux), and
the affected vet check is important enough to release the fix in 1.3.1.
@mdempsky
Copy link
Member

Comment 2:

The issue seems to be creds_test.go (which is a "+build linux" file) is in package
syscall_test.  I think it being first in the list causes vet to skip over the remaining
files that are in package syscall.
If I move creds_test.go into a different directory, then running "go vet syscall" shows
me the sockcmsg_unix.go unsafe.Pointer warning.  That would also explain why Russ and
Rob are seeing different behavior on darwin.

@gopherbot
Copy link

Comment 3:

CL https://golang.org/cl/125990044 mentions this issue.

@rsc
Copy link
Contributor

rsc commented Aug 12, 2014

Comment 4:

This is not important enough to be in 1.3.1.

Labels changed: added release-go1.4, removed release-go1.3.1.

@mdempsky
Copy link
Member

Comment 5:

Is this important enough to be fixed for Go 1.4?
I think it's worth noting that the issue isn't specific to package syscall: it affects
any package where the first XTestGoFiles comes alphabetically before all GoFiles,
CgoFiles, and TestGoFiles.  Within the standard library, the full list of affected
packages (at least for GOOS=linux GOARCH=amd64) is:
archive/zip
compress/zlib
container/heap
container/list
crypto/cipher
crypto/md5
crypto/rand
crypto/sha1
flag
go/printer
image
log
math/rand
mime/multipart
net/http/httptest
net/url
os/exec
os/signal
path
path/filepath
reflect
sort
strings
sync/atomic
syscall
text/tabwriter
time
unicode/utf8

@josharian
Copy link
Contributor

Comment 6:

This has bitten me more than once. I'd really like to see it fixed for 1.4.

@robpike
Copy link
Contributor

robpike commented Sep 22, 2014

Comment 7:

Owner changed to @rsc.

@gopherbot
Copy link

Comment 8:

CL https://golang.org/cl/152220044 mentions this issue.

@rsc
Copy link
Contributor

rsc commented Oct 6, 2014

Comment 9:

This issue was closed by revision 7e6e502.

Status changed to Fixed.

@rsc
Copy link
Contributor

rsc commented Nov 13, 2014

Comment 10:

Issue #6389 has been merged into this issue.

@jscrockett01
Copy link

Comment 11:

See also golang.org/issue/6389 which was resolved by the same fix.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
For example, fixes 'go vet syscall', which has source
files in package syscall_test.

Fixes golang#8511.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/152220044
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 26, 2018
For example, fixes 'go vet syscall', which has source
files in package syscall_test.

Fixes golang#8511.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/152220044
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
For example, fixes 'go vet syscall', which has source
files in package syscall_test.

Fixes golang#8511.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/152220044
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
For example, fixes 'go vet syscall', which has source
files in package syscall_test.

Fixes golang#8511.

LGTM=r
R=golang-codereviews, r
CC=golang-codereviews, iant
https://golang.org/cl/152220044
@rsc rsc removed their assignment Jun 23, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants