package hello is not in GOROOT (/usr/local/go/src/hello)

 2023-09-05 阅读 113 评论 0

摘要:首先将go env中的module打开 然后执行go mod init 如果发生错误: LcqdeMac:hello lcq$ go mod init go: cannot determine module path for source directory /Users/lcq/go_code/src/hello (outside GOPATH, module path must be specified)Example usage:'go mod

首先将go env中的module打开

然后执行go mod init
如果发生错误:

LcqdeMac:hello lcq$ go mod init
go: cannot determine module path for source directory /Users/lcq/go_code/src/hello (outside GOPATH, module path must be specified)Example usage:'go mod init example.com/m' to initialize a v0 or v1 module'go mod init example.com/m/v2' to initialize a v2 moduleRun 'go help mod init' for more information.
LcqdeMac:hello lcq$ 

就在主目录下面新建一个go.mod文件
写上 module “test” 即可了

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://808629.com/420.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 86后生记录生活 Inc. 保留所有权利。

底部版权信息