我想在我的项目中使用IPFS,然后我在研究Go IPFS API。 于是,我写了这个非常简单的代码:尝试将文件发送到IPFS时出现“命令未找到”
package main
import (
"fmt"
"bytes"
sh "github.com/ipfs/go-ipfs-api"
)
func main() {
shell := sh.NewShell("https://ipfs.io")
bufferExample := bytes.NewBufferString("Hello IPFS Shell tests")
mhash, err := shell.AddNoPin(bufferExample)
if err != nil {
panic(err) // ends where
}
fmt.Println(mhash)
}
但我收到错误panic: add: command not found
,我不明白为什么。我的电脑中已经有IPFS(例如,我可以运行deamon)。我还安装了带有开发依赖关系的Go IPFS库。
如何解决?
是的,我已经安装了IPFS命令。例如,我可以运行守护进程。 – Macabeus