无法加载包裹

时间:2017-08-29 17:27:03

标签: go

我在GO中加载包时遇到问题。

我的main.go文件需要::

import (
        "encoding/csv"
        "flag"
        "net/http"
        "os"
        "runtime"
        "strings"

        log "github.com/Sirupsen/logrus"
        "github.com/oliver006/redis_exporter/exporter"
        "github.com/prometheus/client_golang/prometheus"
)

现在在我的go我的SRC文件夹中,

[root@node src]# pwd
/usr/local/go/src

[root@node src]# ls -tlrh github.com/
total 12K
drwxr-xr-x 3 root root 4.0K Aug 29 17:12 Sirupsen
drwxr-xr-x 3 root root 4.0K Aug 29 17:14 oliver006
drwxr-xr-x 3 root root 4.0K Aug 29 17:14 garyburd

当我尝试构建项目时,我得到的错误是:

[root@node redis_exporter]# go build
can't load package: /usr/local/go/src/redis_exporter/main.go:11:2: non-standard import "github.com/Sirupsen/logrus" in standard package "redis_exporter"

有一次我不小心跑了一个命令:

go get github.com/prometheus/client_golang/prometheus

我不确定这是否会导致问题。有没有办法将其还原?

0 个答案:

没有答案