- 已关闭。**此问题为not reproducible or was caused by typos。当前不接受答案。
这个问题是由打字错误或无法再重现的问题引起的。虽然类似的问题在这里可能是on-topic,但这个问题的解决方式不太可能帮助未来的读者。
21小时前关门了。
Improve this question
我想安装go-fastping。但是当我尝试时,发生了这种情况:第一个月
go: go.mod file not found in current directory or any parent directory.
'go get' is no longer supported outside a module.
To build and install a command, use 'go install' with a version,
like 'go install example.com/cmd@latest'
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.
所以我改为安装:go install github.com/tatsushid/go-fastping
Try 'go install github.com/tatsushid/go-fastping@latest' to install the latest version ```
and after I did changed to: `go install github.com/tatsushid/go-fastping@latest`
it worked but when I try to add it in the code it says that the module is not installed.
1条答案
按热度按时间dpiehjr41#
您的项目很可能没有
go.mod
文件。在项目的根目录中运行
go mod init <module-name>
创建一个模块,然后运行go get -u github.com/tatsushid/go-fastping
将此依赖项添加到项目中。