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

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

調用 `go get` 時缺少 Git 命令

調用 `go get` 時缺少 Git 命令

Go
楊__羊羊 2023-06-19 13:54:10
我的文件FROM golang:1.10.2-alpine3.7 AS buildRUN apk --no-cache add gcc g++ make ca-certificatesRUN apk add gitWORKDIR /go/src/github.com/meowerCOPY Gopkg.lock Gopkg.toml ./COPY util utilCOPY event eventCOPY db dbCOPY search searchCOPY schema schemaCOPY meow-service meow-serviceCOPY query-service query-serviceCOPY pusher-service pusher-serviceRUN go get -d -v ./...RUN go install ./...FROM alpine:3.7WORKDIR /usr/binCOPY --from=build /go/bin .我添加了 apk add git line.Without 這條線我的 docker-compose up 產生了Step 13/17 : RUN go get -d -v ./... ---> Running in d917adba00cdgithub.com/lib/pq (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/lib/pq: exec: "git": executable file not found in $PATHgithub.com/nats-io/go-nats (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/nats-io/go-nats: exec: "git": executable file not found in $PATHgithub.com/gorilla/mux (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/gorilla/mux: exec: "git": executable file not found in $PATHgithub.com/kelseyhightower/envconfig (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/kelseyhightower/envconfig: exec: "git": executable file not found in $PATHpackage github.com/retry: invalid github.com/ import path "github.com/retry"github.com/segmentio/ksuid (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/segmentio/ksuid: exec: "git": executable file not found in $PATHgithub.com/gorilla/websocket (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/gorilla/websocket: exec: "git": executable file not found in $PATHgithub.com/olivere/elastic (download)go: missing Git command. See https://golang.org/s/gogetcmdpackage github.com/olivere/elastic: exec: "git": executable file not found in $PATH這是什么意思?
查看完整描述

1 回答

?
MMMHUHU

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

go get在內部調用用于托管要獲取的包的特定 VCS 的“參考”客戶端工具。換句話說,go get它本身不知道如何與 VCS 服務器交互。

所以是的,為了go get一個由 Git 托管的包,您需要提供可調用git二進制文件的工作 Git 安裝。

至于你的第二個問題,它似乎與 Go 沒有任何關系,所以我建議你做一些研究,然后問一個單獨的問題,alpine如果失敗的話。


查看完整回答
反對 回復 2023-06-19
  • 1 回答
  • 0 關注
  • 179 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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