ondrajz / go-callvis

Visualize call graph of a Go program using Graphviz
https://ofabry.github.io/go-callvis
MIT License
5.82k stars 402 forks source link

No working in go 1.19 #130

Closed xushuhui closed 1 year ago

xushuhui commented 1 year ago

This is error in go1.19 darwin/arm64

panic: no concrete method: func (sync/atomic.Pointer[go/token.File]).CompareAndSwap(old go/token.File, new *go/token.File) (swapped bool)

goroutine 7994 [running]: golang.org/x/tools/go/ssa.(Program).declaredFunc(0x14025f4b860, 0x14052b23f20) /Users/xsh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200305224536-de023d59a5d1/go/ssa/methods.go:124 +0x108 golang.org/x/tools/go/ssa.(Program).addMethod(0x105177bf8?, 0x14033f82280, 0x14052b1b9f0) /Users/xsh/go/pkg/mod/golang.org/x/tools@v0.0.0-20200305224536-de023d59a5d1/go/ssa/methods.go:86 +0x148

vovean commented 1 year ago

@xushuhui Hi I have also encountered this issue. However, it seems to me, I have solved it. So, to make it work with go1.19 I downloaded the repo with git clone, changed go.mod to bump tools to 0.1.12. This is my go.mod now

module github.com/ofabry/go-callvis

go 1.17

require (
    github.com/goccy/go-graphviz v0.0.9
    github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
    golang.org/x/tools v0.1.12
)

require (
    github.com/fogleman/gg v1.3.0 // indirect
    github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
    github.com/pkg/errors v0.9.1 // indirect
    golang.org/x/image v0.0.0-20220617043117-41969df76e82 // indirect
    golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
    golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
)

Then, I built it locally: make install and this was it Now I'm able to run go-callvis against go1.19 projects with generics and stuff

houseme commented 1 year ago

ld: warning: -no_pie is deprecated when targeting new OS versions