I’m on Ubuntu and installed tools with
sudo apt install golang-golang-x-tools
When I run
callgraph -format digraph main.go I get lots of errors like:
main.go:12:2: could not import context (cannot find package "context" in any of:
/usr/lib/go-1.6/src/context (from $GOROOT)
/home/brent/repos/go/src/context (from $GOPATH))
But when I run
go env I get a different GOROOT
So I think I installed an outdated version of x-tools.
Is there a way to install 1.13 x-tools?
Or, can build callgraph from source and call its executable directly?
It’s not outdated. It’s because Ubuntu team customizes it to the point where it differs from actual documentation and performs outside of supporting range.
To recover, simply
sudo apt purge it and install a fresh one via @iegomez mentioning.
Debian is fine. It encourages and foster the actual Golang site download and installation path.
It’s Ubuntu specific issue because I witnessed in the past they broke the go doc web server by shifting the docs out to some
/libs path before go1.10. I’m still wondering why they wanted to package that way that introduces more cost and problems and automate the installation by the official guide.
Thanks for the updates; I managed to resolve the issue by building
callgraph from master then using that executable.
Still in shock from how fast go builds.
Anyway, I’m not longer on Ubuntu; already shifted to Debian since Stretch due to many things are behaving weirdly and the OS crashed without recovery after some time distro upgrades.
Would you mind post your solution and mark the issue as “mark as solved” please? So that others can move on to the next problem.
Built locally with
go get -u golang.org/x/tools/...
On first reading of the readme of gotools I was not aware that was the command to build! Learnings.
And yes; I am still on ubuntu 16 because upgrading versions have corrupted in the past
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.