We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The usage text of x/tools/cmd/callgraph command mentions:
x/tools/cmd/callgraph
e.g. Caller.Pkg.Object.Path yields the import path of the enclosing package. Consult the go/ssa API documentation for details.
Examples: callgraph -format '{{.Caller.Pkg.Object.Path}} -> {{.Callee.Pkg.Object.Path}}' \ $GOROOT/src/net/http/triv.go | sort | uniq
Examples:
callgraph -format '{{.Caller.Pkg.Object.Path}} -> {{.Callee.Pkg.Object.Path}}' \ $GOROOT/src/net/http/triv.go | sort | uniq
Caller is *ssa.Function. Its Pkg field is *ssa.Package. But ssa.Package struct doesn't contain either field or method named Object.
Caller
*ssa.Function
Pkg
*ssa.Package
ssa.Package
Object
So one gets the following error:
$ callgraph -format '{{.Caller.Pkg.Object.Path}} -> {{.Callee.Pkg.Object.Path}}' $(go env GOROOT)/src/net/http/triv.go | sort | uniq callgraph: template: -format:1:9: executing "-format" at <.Caller.Pkg.Object.P...>: can't evaluate field Object in type *ssa.Package
I'm guessing that instead of Caller.Pkg.Object.Path, it should be Caller.Pkg.Pkg.Path:
Caller.Pkg.Object.Path
Caller.Pkg.Pkg.Path
https://godoc.org/golang.org/x/tools/go/ssa#Package.Pkg
That works as expected in my testing.
My environment details:
go version
$ go version go version go1.8.1 darwin/amd64
go env
$ go env GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/Dmitri/Dropbox/Work/2013/GoLanding:/Users/Dmitri/Dropbox/Work/2013/GoLand" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/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/tw/kgz4v2kn4n7d7ryg5k_z3dk40000gn/T/go-build822597389=/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"
The text was updated successfully, but these errors were encountered:
CL https://golang.org/cl/43812 mentions this issue.
Sorry, something went wrong.
golang/tools@5831d16
No branches or pull requests
The usage text of
x/tools/cmd/callgraph
command mentions:Caller
is*ssa.Function
. ItsPkg
field is*ssa.Package
. Butssa.Package
struct doesn't contain either field or method namedObject
.So one gets the following error:
I'm guessing that instead of
Caller.Pkg.Object.Path
, it should beCaller.Pkg.Pkg.Path
:https://godoc.org/golang.org/x/tools/go/ssa#Package.Pkg
That works as expected in my testing.
My environment details:
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?The text was updated successfully, but these errors were encountered: