go: go.mod file not found in current directory or any parent directory.如何解决?

时间:2024-04-03 08:29:14

这个错误表明你正在执行 go get 命令,但是当前目录或任何父目录中都找不到 go.mod 文件。这可能是因为你的项目还没有使用 Go Modules 进行管理。

要解决这个问题,有几种方法:

go mod init <module-name>

其中 <module-name> 是你的项目名称,这将创建一个新的 go.mod 文件。

再次执行  go get -u fyne.io/fyne/v2/cmd/fyne@v2.3.0  正常。