golang相关错误处理
#Go语言 VS Code 远程到linux服务器F5运行错误
package main
import "fmt"
func main() {
fmt.Println("Hello,World!")
}编译如果报以下错,
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
则在终端中键入以下命令,init后的是包名,可以自主修改,如果键入go mod init,没有带上包名,命令行会报错,根据Example usage修改指令即可
go mod init example.com/m
go mod init hello.go # 我这里上面的文件名为hello.go
再次F5运行,即可成功输出hello world
最后更新于