报错:entry.go:5:2: package learngo/tree is not in GOROOT (/usr/local/go/src/learngo/tree)
解决方案:
折腾了两小时,问题解决了,但未完全理解。列下解决过程。
1、 go mod init learngo/tree (learngo文件目录名,tree包名)
2、 Goland——Preferences…——Go——GOPATH——右侧勾选 Index entire GOPATH——OK
3、 会生成两个文件:go.mod 、 pkg
。。。。。。。。。。。。。。。。。。。。。。。。。。
在网上看到两篇不错的解决方案,推荐下: https://blog.csdn.net/Homewm/article/details/85208680 https://www.jb51.net/article/202151.htm