Golang 1.5供应商 - 找不到包装

时间:2015-10-09 09:17:28

标签: go

尝试使用版本1.5并使用GO15VENDOREXPERIMENT="1"在go lang中构建我的项目,以确保我在本地查找供应商。

我的结构是:

apps_api
   main.go
   build.sh
   src
      controllers
      models
      views
   vendor
      github.com
      golang.org
      .....

build.sh包含

export GO15VENDOREXPERIMENT="1"
export GOPATH=`pwd`
go build .

控制器文件示例

import (
    "models"
    "views"

    "github.com/gin-gonic/gin"
)

但是我收到很多错误,说没有找到包装,请参阅下面的例子

src/controllers/app-versions.go:10:2: cannot find package "github.com/asaskevich/govalidator" in any of:
    /Users/ereeve/.gvm/gos/go1.5/src/github.com/asaskevich/govalidator (from $GOROOT)
    /Users/ereeve/Documents/gocode/src/apps_api/src/github.com/asaskevich/govalidator (from $GOPATH)

src/controllers/index.go:4:2: cannot find package "github.com/chnlr/baseurl" in any of:
    /Users/ereeve/.gvm/gos/go1.5/src/github.com/chnlr/baseurl (from $GOROOT)
    /Users/ereeve/Documents/gocode/src/apps_api/src/github.com/chnlr/baseurl (from $GOPATH)

如果我将这些行添加到我的build.sh文件中它将构建,但我不想使用go get,因为我在我的项目中使用本地供应商的1.5以避免依赖。

# go get github.com/gin-gonic/gin
# go get github.com/go-sql-driver/mysql
# go get github.com/rif/cache2go
....

任何想法我做错了什么?

1 个答案:

答案 0 :(得分:8)

IIRC,$timesheets = TimesheetQuery::create() ->select(Timesheet::getTransferFieldsWithRelations()) ... ->joinWith("Timesheet.FromSite FromSite", Criteria::LEFT_JOIN) ->joinWith("Timesheet.ToSite ToSite", Criteria::LEFT_JOIN) ->joinWith("Timesheet.Site Site", Criteria::LEFT_JOIN) ... 仅在您正在构建的套餐位于GO15VENDOREXPERIMENT内时才有效,因此设置

$GOPATH/src
export GOPATH=`pwd` 中的

使其失败。如果您将build.sh置于apps_api内并运行

~/fakegopath/src/

它应该有用。