有趣有盼 无灾无难
go run时报错:
package test1/pkg is not in GOROOT
原因: go.mod 中的module不匹配,因为项目名冲突我把项目名从test改成了test1,但go.mod文件中的module没有对应改成test1,所以导致了包找不到。 解决: 把go.mod文件中的module修改成test1,然后go mod tidy后重新运行。
test
test1
go mod tidy