- 原因是我设置了go的环境变量go env -w GO111MODULE=on
- 这个配置是强制使用mod模式
- 把配置修改成auto即可解决
- 症状 (vscode go 不能转到定义, 没有错误提示)
The code in the workspace failed to compile (see the error message below). If you believe this is a mistake, please file an issue: https://github.com/golang/go/issues/new. go [-e -json -compiled=true -test=true -export=false -deps=true -find=false -- ./]: exit status 1: go: cannot find main module; see 'go help modules' : packages.Load error