go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘
Posted 谁吃薄荷糖
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘相关的知识,希望对你有一定的参考价值。
go build报错:
go: go.mod file not found in current directory or any parent directory; see ‘go help modules’
需要执行go mod init 初始化项目
编写demo:
package main
import "fmt"
func main(){
fmt.Println("hello world.")
}
编译:go build
报错了
使用go mod init修复问题
继续编译,得到可执行程序,完成第一个demo
以上是关于go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘的主要内容,如果未能解决你的问题,请参考以下文章
go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘
go.mod file not found in current directory or any parent directory; see ‘go help modules‘
go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘
go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘
解决go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘
解决go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘