亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

main.go 無法找到軟件包

main.go 無法找到軟件包

Go
肥皂起泡泡 2022-08-01 09:57:00
實際上我想用它來生成用于視頻的文件,所以我找到了下面開發來做這個事情,所以我克隆了這個 https://github.com/Avalanche-io/c4/tree/v0.7.0c4c4 id reporepo現在,正如堆棧溢出的答案中所建議的那樣:無法從github安裝c4的cmd版本我在終端中執行以下命令ubuntugo get github.com/Avalanche-iogo get github.com/Avalanche-io/c4/idgo get github.com/Avalanche-io/c4/cmd/c4然后,正如他們在如何使用這個的例子中所顯示的那樣repopackage mainimport (  "fmt"  "io"  "os"  c4 "github.com/avalanche-io/c4/id")func main() {  file := "main.go"  f, err := os.Open(file)  if err != nil {    panic(err)  }  defer f.Close()  // create a ID encoder.  e := c4.NewEncoder()  // the encoder is an io.Writer  _, err = io.Copy(e, f)  if err != nil {    panic(err)  }  // ID will return a *c4.ID.  // Be sure to be done writing bytes before calling ID()  id := e.ID()  // use the *c4.ID String method to get the c4id string  fmt.Printf("C4id of \"%s\": %s\n", file, id)  return}我只是復制了這個相同的示例并創建了一個文件,當我運行此命令時,他們在 https://github.com/Avalanche-io/c4/blob/v0.7.0/id/README.md 中定義了該命令,該命令是文件的c4 id''',如他們在示例中所示。我收到以下錯誤main.goREADME.mdgo run main.go  ```` Instead of getting the main.go:8:3: cannot find package "github.com/avalanche-io/c4/id" in any of:    /usr/lib/go-1.13/src/github.com/avalanche-io/c4/id (from $GOROOT)    /home/vinay/go/src/github.com/avalanche-io/c4/id (from $GOPATH)我不懂語言,所以對我來說很難解決這里的問題,有沒有什么開發人員可以幫助我。gogo
查看完整描述

1 回答

?
qq_遁去的一_1

TA貢獻1725條經驗 獲得超8個贊

main.go文件里面找不到包,正如我所看到的你已經運行了以下命令github.com/avalanche-io/c4/id/home/vinay/go/src/github.com/avalanche-io/c4/id go get 


go get github.com/Avalanche-io

go get github.com/Avalanche-io/c4/id

go get github.com/Avalanche-io/c4/cmd/c4


但是它們都沒有名字,所以根據我的說法,你需要執行以下命令github.com/avalanche-io/c4/id


go get github.com/avalanche-io/c4/id

現在只需運行您的 main.go


go run main.go


查看完整回答
反對 回復 2022-08-01
  • 1 回答
  • 0 關注
  • 145 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號