Golang失败,改变导入模块的名称

我试图把SkyDNSv1带回到生活中,并从我的fork(这里是Dockerfile )中构build它。 SkyDNS对于快速服务发现来说是非常好的,简单的工具,但是它并没有被更新很久。

在构build过程中有一个错误,它是由第三方库引起的。 我无法弄清楚为什么会发生这种情况:

$ docker build --no-cache -t skydns1 . Sending build context to Docker daemon 1.566 MB Sending build context to Docker daemon Step 0 : FROM golang:1.4.2 ---> 3e8cb8e0c765 Step 1 : WORKDIR /go/src ---> Running in 3a06cf460ad9 ---> 1dd14a099164 Removing intermediate container 3a06cf460ad9 Step 2 : RUN go get github.com/codegangsta/cli ---> Running in eabcfd6fe621 ---> c9ea222f2d74 Removing intermediate container eabcfd6fe621 Step 3 : RUN go get github.com/vitalyisaev2/skydns1 ---> Running in 3264582b2e7a # github.com/rcrowley/go-metrics/influxdb github.com/rcrowley/go-metrics/influxdb/influxdb.go:19: undefined: client.ClientConfig github.com/rcrowley/go-metrics/influxdb/influxdb.go:38: undefined: client.Series github.com/rcrowley/go-metrics/influxdb/influxdb.go:44: undefined: client.Series github.com/rcrowley/go-metrics/influxdb/influxdb.go:52: undefined: client.Series github.com/rcrowley/go-metrics/influxdb/influxdb.go:60: undefined: client.Series github.com/rcrowley/go-metrics/influxdb/influxdb.go:70: undefined: client.Series github.com/rcrowley/go-metrics/influxdb/influxdb.go:82: undefined: client.Series github.com/rcrowley/go-metrics/influxdb/influxdb.go:93: undefined: client.Series github.com/rcrowley/go-metrics/influxdb/influxdb.go:106: client.WriteSeries undefined (type *client.Client has no field or method WriteSeries) INFO[0075] The command [/bin/sh -c go get github.com/vitalyisaev2/skydns1] returned a non-zero code: 

但是如果你查看导致这个错误的文件 ,你会注意到Golang对influxdb/client感到困惑。 我认为编译器不会像使用influxClient一样replace导入的名称client

 package influxdb import ( "fmt" influxClient "github.com/influxdb/influxdb/client" "github.com/rcrowley/go-metrics" "log" "time" ) 

可能我只是错过了一个明显的错误。 任何帮助将不胜感激。

Go编译器不会replace或重写任何东西,代码是错误的。 github.com/rcrowley/go-metrics/influxdb软件包是使用其他一些不再存在的influxdb客户端代码编写的。 (看起来好像已经有一些github问题了)

如果你看一下当前的influxdb / client包,你会发现根本没有SeriesClientConfig或者Client.WriteSeries 。 您需要删除对github.com/rcrowley/go-metrics/influxdb的依赖关系,才能build立您的项目。