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.

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

报告相同问题?

悬赏问题

  • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类