douji2520 2014-07-15 20:36
浏览 17
已采纳

转到“找不到导入”

I'm attempting to incorporate Heroku's log-shuttle library (https://github.com/heroku/log-shuttle) into a Go project I'm working on. The tool is primarily designed to be run as an independent binary, but I'm hoping to integrate it in a different way in my tool.

So I get the library:

$ go get github.com/heroku/log-shuttle
$ ls $GOPATH/src/github.com/heroku/log-shuttle/
  batcher.go       Godeps ...
  ...

which returns successfully. Then I try to import the library:

package myPackage

import (
  "github.com/heroku/log-shuttle"
  "fmt"
  "log"
)
...

Great. But now I go to go build and...

$ go build
# github.com/<my project>
logWriter/log_shuttle_writer.go:5: can't find import: "github.com/heroku/log-shuttle"

I have my GOPATH set correctly (I believe):

$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jeff/go/"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"

And the package is installed and built, but it doesn't want to import. As you can see, there are non non-ASCII chars in the package path (though the hyphen is non-alpha-numeric), and I can't find any more info about what could be causing this problem.

Not sure how it would matter, but I am using godep to try to manage my dependencies.

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • dongshi1102 2014-07-15 20:40
    关注

    github.com/heroku/log-shuttle is a main package, not an importable library, meaning it's meant to be compiled and run as a binary.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作