从github上下载golang项目到本地运行go build编译,IDE上显示raycast.go: package raycast/engine is not in GOROOT (D:\Go\src\raycast\engine)错误

下面是项目结构:
Go项目: package project/name is not in GOROOT
golang使用gopath或者gomod模式进行包管理,我使用gomod模式

export GO111MODULE=on

E:\raycastergo\目录下运行go mod init raycastergogo mod tidy命令。目录下会生成两个文件。就可以解决上面出现的raycast.go: package raycast/engine is not in GOROOT (D:\Go\src\raycast\engine)错误

go.mod
go.sum

注意:go mod init后面所跟的名称raycastergo必须与项目名称raycastergo一致

Go项目: package project/name is not in GOROOT

否则会报错:

raycast.go: package raycast/engine is not in GOROOT (D:\Go\src\raycast/engine)

相关文章:

  • 2022-12-23
  • 2022-02-11
  • 2021-08-14
  • 2021-11-02
  • 2021-09-23
  • 2021-08-07
  • 2021-09-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2023-03-21
相关资源
相似解决方案