I'm now developing software to resolve types using go/types package. In order to resolve to go modules dependencies, it uses a custom importer using `golang.org/x/tools/go/packages`. (Ref: https://github.com/mdempsky/gocode/issues/46#issuecomment-417950836)
This will work correctly in many cases, but type check fails when it passes a function as an argument. The following is an example: https://gist.github.com/wata727/345e0be0b8e345f1307bcf38362795a9 When you execute the above code, the following error occurs: % go run main.go panic: main.go:10:21: cannot use walker (value of type func(path string, info os.FileInfo, err error) error) as path/filepath.WalkFunc value in argument to filepath.Walk goroutine 1 [running]: main.main() /Users/watanabekazuma/workspace/golang/src/github.com/wata727/ ssa_example/repro/main.go:27 +0x2d2 exit status 2 However, this `project/main.go` can be executed normally. That is, no type error has occurred. % cd project % go run main go run main.go .main.go By the way, using `importer.Default()` as importer does not cause this error. Why does type check fail with custom importer? go env GOARCH="amd64" GOBIN="" GOCACHE="/Users/watanabekazuma/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/watanabekazuma/workspace/golang" GOPROXY="" GORACE="" GOROOT="/usr/local/Cellar/go/1.11/libexec" GOTMPDIR="" GOTOOLDIR="/usr/local/Cellar/go/1.11/libexec/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="" 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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ds/c5vrpyx94xv7xxzvrf9_qyx00000gn/T/go-build429329010=/tmp/go-build -gno-record-gcc-switches -fno-common" golang.org/x/tools: commit f60d9635b16a5a57b06eaa119614ba4df421966a -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.