处理【go: go.mod file not found in current directory or any parent directory; see 'go help modules'】报错
--发布于 2022-12-09 21:14:35
在编译go项目时,报如下错
zwm@zwm-PC:~/workspace/wsserver$ go build
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
解决办法:执行go mod初始化
# go mod 初始化的格式为
# go mod init <所在目录名>
# 于是,我们执行
go mod init wsserver
# 就可以继续执行go build命令了
参考
解决go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘
--更新于 2023-03-09 10:51:41