调用 `go get` 时缺少 Git 命令

我的文件


FROM golang:1.10.2-alpine3.7 AS build

RUN apk --no-cache add gcc g++ make ca-certificates

RUN apk add git

WORKDIR /go/src/github.com/meower


COPY Gopkg.lock Gopkg.toml ./

COPY util util

COPY event event

COPY db db

COPY search search

COPY schema schema

COPY meow-service meow-service

COPY query-service query-service

COPY pusher-service pusher-service


RUN go get -d -v ./...

RUN go install ./...


FROM alpine:3.7

WORKDIR /usr/bin

COPY --from=build /go/bin .

我添加了 apk add git line.Without 这条线我的 docker-compose up 产生了


Step 13/17 : RUN go get -d -v ./...

 ---> Running in d917adba00cd

github.com/lib/pq (download)

go: missing Git command. See https://golang.org/s/gogetcmd

package github.com/lib/pq: exec: "git": executable file not found in $PATH

github.com/nats-io/go-nats (download)

go: missing Git command. See https://golang.org/s/gogetcmd

package github.com/nats-io/go-nats: exec: "git": executable file not found in $PATH

github.com/gorilla/mux (download)

go: missing Git command. See https://golang.org/s/gogetcmd

package github.com/gorilla/mux: exec: "git": executable file not found in $PATH

github.com/kelseyhightower/envconfig (download)

go: missing Git command. See https://golang.org/s/gogetcmd

package github.com/kelseyhightower/envconfig: exec: "git": executable file not found in $PATH

package 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/gogetcmd

package github.com/segmentio/ksuid: exec: "git": executable file not found in $PATH

github.com/gorilla/websocket (download)

go: missing Git command. See https://golang.org/s/gogetcmd

package github.com/gorilla/websocket: exec: "git": executable file not found in $PATH

github.com/olivere/elastic (download)

go: missing Git command. See https://golang.org/s/gogetcmd

package github.com/olivere/elastic: exec: "git": executable file not found in $PATH


这是什么意思?


杨__羊羊
浏览 136回答 1
1回答

MMMHUHU

go get在内部调用用于托管要获取的包的特定 VCS 的“参考”客户端工具。换句话说,go get它本身不知道如何与 VCS 服务器交互。所以是的,为了go get一个由 Git 托管的包,您需要提供可调用git二进制文件的工作 Git 安装。至于你的第二个问题,它似乎与 Go 没有任何关系,所以我建议你做一些研究,然后问一个单独的问题,alpine如果失败的话。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Go