我想在我的項目中使用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