douji9184 2016-04-01 14:54
浏览 63
已采纳

为什么找不到我的供应库?

package vpc_app/unit_test.go:

import (
    "github.com/my-org/my-library/http"
)
...

package github.com/my-org/my-library/http/http.go:

package http
...

File Structure:

$ tree
tree
.
├── glide.lock
├── glide.yaml
├── unit
│   └── modules
│       └── vpc
│           └── vpc-app
│               └── unit_test.go
└── vendor
    └── github.com
        └── my-org
            └── my-library
                ├── http
                │   └── http.go

Problem:

When I run go test ./... I get this error:

vendor/github.com/my-org/my-library/url_checker.go:7:2: cannot find package "github.com/my-org/my-library/http" in any of:
    /usr/local/go/src/github.com/my-org/my-library/http (from $GOROOT)
    /Users/josh/go/src/github.com/my-org/my-library/http (from $GOPATH)

Question:

I'm using go 1.6, but it doesn't seem to look in my vendor directory to find the package. Any ideas on why that might be?

Update #1: As requested, here's my go env output:

OARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/josh/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT="1"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

展开全部

  • 写回答

2条回答 默认 最新

  • duanqin7791 2016-04-01 15:20
    关注

    My repo wasn't located in the GOPATH. Moving it to $GOPATH/src/github.com/my-org/my-library did the trick.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部