douben7493 2014-02-22 09:48
浏览 193

进行构建:“找不到包”(即使设置了GOPATH)

My question is quite similar to this,different is I have directory hierarchy as best answer pointed out,but I still get same problem,why?

$ echo $GOROOT
/usr/local/go

$ echo $GOPATH
/home/mitchell/go

$ cat /home/mitchell/go/src/main.go
package main
import "comment/create"
func main() { }

$ cat /home/mitchell/go/src/comment/create/***.go(bunch of go files)
package create

$ go build main.go
main.go:3:8: import "comment/create": cannot find package
  • 写回答

1条回答 默认 最新

  • doujuncuo9339 2014-02-25 16:20
    关注

    I feel like your directory structure is wrong:

    go/src/comment/create

    should be something like

    go/src/github.com/"your git org"/comment/create

    For instance, my github organization is SupportLocal, my repo is "Comment", create is my go package name, my directory would look like this:

    go/src/github.com/supportlocal/comment/create

    Then your import would look like this:

    "github.com/supportlocal/comment/create"

    Let me know if that works.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度