vscode 配置完go语言环境后仍然无法运行程序
package main
import "fmt"
func main() {
fmt.Println("Hello, 世界")
}
DAP server listening at: 127.0.0.1:63740
Build Error: go build -o c:\Users\86139\Desktop\go__debug_bin.exe -gcflags all=-N -l .
go: go.mod file not found in current directory or any parent directory; see 'go help modules' (exit status 1)
你需要将代码放到 gopath 环境变量指示的目录下面
或者更推荐启用 gomod:
go mod init your_modname
go mod tidy