Golang failes更改导入模块

时间:2015-06-18 18:18:10

标签: go docker skydns

我正试图让SkyDNSv1恢复生机并从我的叉子构建它(这里是Dockerfile)。 SkyDNS是用于快速服务发现的非常好的简单工具,但它很长时间没有更新。

构建过程中存在错误,它是由第三方库引起的。我无法弄清楚为什么会这样:

$ 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: 

但如果你查看导致此错误的file,你会发现Golang对influxdb/client感到困惑。 我认为编译器不会将导入的名称client替换为influxClient,因为它应该这样做:

package influxdb

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

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

1 个答案:

答案 0 :(得分:3)

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

如果查看当前的influxdb/client包,您会发现根本没有SeriesClientConfigClient.WriteSeries。您需要放弃github.com/rcrowley/go-metrics/influxdb的依赖关系才能构建项目。