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

x/tools/cmd/guru: Missing 'whicherrs' mode in what query to error type variable? #18938

Open
yangxikun opened this issue Feb 4, 2017 · 1 comment
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@yangxikun
Copy link

Please answer these questions before submitting your issue. Thanks!

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

go version go1.7.4 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/rokety/Software/go-app"
GORACE=""
GOROOT="/home/rokety/Software/go"
GOTOOLDIR="/home/rokety/Software/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build113479709=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

Run guru what mode query on an error type variable:

guru -scope net what /home/rokety/Software/go/src/net/net.go:#5854

src/net/net.go:

// Read implements the Conn Read method.
func (c *conn) Read(b []byte) (int, error) {
	if !c.ok() {
		return 0, syscall.EINVAL
	}
	n, err := c.fd.Read(b) // #5854 pos
	if err != nil && err != io.EOF {
		err = &OpError{Op: "read", Net: c.fd.net, Source: c.fd.laddr, Addr: c.fd.raddr, Err: err}
	}
	return n, err
}

What did you expect to see?

Should contains 'whicherrs' in output modes.

Run guru whicherrs mode query on the variable:
guru -scope net whicherrs /home/rokety/Software/go/src/net/net.go:#5854

/home/rokety/Software/go/src/net/net.go:173:6: this error may point to these globals:
/home/rokety/Software/go/src/net/net.go:375:2: 	errTimeout
/home/rokety/Software/go/src/net/net.go:377:2: 	errClosing
/home/rokety/Software/go/src/io/io.go:38:5: 	io.EOF
/home/rokety/Software/go/src/net/net.go:173:6: this error may contain these constants:
/home/rokety/Software/go/src/syscall/zerrors_linux_amd64.go:1211:2: 	syscall.EAFNOSUPPORT
/home/rokety/Software/go/src/syscall/zerrors_linux_amd64.go:1212:2: 	syscall.EAGAIN
/home/rokety/Software/go/src/syscall/zerrors_linux_amd64.go:1245:2: 	syscall.EINVAL
/home/rokety/Software/go/src/syscall/zerrors_linux_amd64.go:1280:2: 	syscall.ENOENT
/home/rokety/Software/go/src/net/net.go:173:6: this error may contain these dynamic types:
/home/rokety/Software/go/src/net/net.go:486:6: 	*timeoutError
/home/rokety/Software/go/src/os/error.go:29:6: 	*os.SyscallError
/home/rokety/Software/go/src/syscall/syscall_unix.go:100:6: 	syscall.Errno

What did you see instead?

/home/rokety/Software/go/src/net/net.go:173.5-173.7: identifier
/home/rokety/Software/go/src/net/net.go:173.2-173.23: assignment
/home/rokety/Software/go/src/net/net.go:169.44-178.1: block
/home/rokety/Software/go/src/net/net.go:169.1-178.1: function declaration
/home/rokety/Software/go/src/net/net.go:79.1-606.1: source file
-: modes: [callers callstack definition describe implements pointsto referrers]
-: srcdir: /home/rokety/Software/go/src
-: import path: net
/home/rokety/Software/go/src/net/net.go:173:5: err
/home/rokety/Software/go/src/net/net.go:174:5: err
/home/rokety/Software/go/src/net/net.go:174:19: err
/home/rokety/Software/go/src/net/net.go:175:3: err
/home/rokety/Software/go/src/net/net.go:175:88: err
/home/rokety/Software/go/src/net/net.go:177:12: err
@bradfitz bradfitz added this to the Unreleased milestone Feb 4, 2017
@gopherbot
Copy link

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

gopherbot pushed a commit to golang/tools that referenced this issue Mar 4, 2017
A 'what' query reports which other query modes are applicable to the
selected syntax.  A 'whicherrs' query is similar to a 'pointsto'
query, so we enable it using the same criteria.

Fixes issue golang/go#18938

Change-Id: Iae062e0c933c7764bc335488adabf816d63ac837
Reviewed-on: https://go-review.googlesource.com/37349
Reviewed-by: Dominik Honnef <dominik@honnef.co>
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants