Skip to content

cmd/vet: go vet syscall doesn't show anything whereas go tool vet pkg/syscall shows a warning #8511

Closed
@minux

Description

@minux
$ 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.

Activity

mdempsky

mdempsky commented on Aug 11, 2014

@mdempsky
Contributor

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

gopherbot commented on Aug 12, 2014

@gopherbot
Contributor

Comment 3:

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

rsc commented on Aug 12, 2014

@rsc
Contributor

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

mdempsky commented on Sep 16, 2014

@mdempsky
Contributor

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

josharian commented on Sep 16, 2014

@josharian
Contributor

Comment 6:

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

robpike commented on Sep 22, 2014

@robpike
Contributor

Comment 7:

Owner changed to @rsc.

gopherbot

gopherbot commented on Oct 6, 2014

@gopherbot
Contributor

Comment 8:

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

rsc commented on Oct 6, 2014

@rsc
Contributor

Comment 9:

This issue was closed by revision 7e6e502.

Status changed to Fixed.

rsc

rsc commented on Nov 13, 2014

@rsc
Contributor

Comment 10:

Issue #6389 has been merged into this issue.

jscrockett01

jscrockett01 commented on Nov 13, 2014

@jscrockett01

Comment 11:

See also golang.org/issue/6389 which was resolved by the same fix.
added this to the Go1.4 milestone on Apr 14, 2015
locked and limited conversation to collaborators on Jun 25, 2016
added 2 commits that reference this issue on Jun 25, 2018
48deba8
5d966bc
added a commit that references this issue on Jul 9, 2018
0b81e5a
added a commit that references this issue on Jul 30, 2018
2078489
removed their assignment
on Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mdempsky@josharian@rsc@minux@robpike

        Issue actions

          cmd/vet: go vet syscall doesn't show anything whereas go tool vet pkg/syscall shows a warning · Issue #8511 · golang/go