Closed timmyyuan closed 3 years ago
I create a go test file (my_test.go) in a empty directory:
my_test.go
package my_test import ( "go.uber.org/goleak" "testing" ) func TestFunc(t *testing.T) { defer goleak.VerifyNone(t) var x int x = 1 / x }
And then add its mod file:
module my_test go 1.15 require go.uber.org/goleak v1.1.10
Then, I use go-callvis to visit the call graph of my_test.go by
go-callvis -tests .
There should be a function "TestFunc" displayed on the browser but I could not find it. Is this caused by my wrong operations?
Some system information:
$ OS ubuntu 20.04 in windows WSL2
$ go version go version go1.15.6 linux/amd64
go env
$ go env GO111MODULE="on" GOARCH="amd64" GOBIN="" GOCACHE="/home/yuanting/.cache/go-build" GOENV="/home/yuanting/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/yuanting/go/pkg/mod" GONOPROXY="github.com/timmyyuan/pautil" GONOSUMDB="github.com/timmyyuan/pautil" GOOS="linux" GOPATH="/home/yuanting/go" GOPRIVATE="github.com/timmyyuan/pautil" GOPROXY="https://goproxy.cn,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/tmp/pautil-test-896714642/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build989666205=/tmp/go-build -gno-record-gcc-switches"
I can't reproduce it on MacOS.
Sorry it's my mistake, the node of "TestFunc" should in testing package because it is called by tRunner actually.
I create a go test file (
my_test.go
) in a empty directory:And then add its mod file:
Then, I use go-callvis to visit the call graph of
my_test.go
byThere should be a function "TestFunc" displayed on the browser but I could not find it. Is this caused by my wrong operations?
Some system information:
go env
Output