小编Pau*_*ich的帖子

云函数和本地依赖

我正在尝试使用部署命令部署到谷歌云,我的代码使用 github url 引用本地包。使用 gcloud deploy 命令进行部署时,我得到了以下信息。所以在这个例子中。我的端点包是指使用完整 git url 的本地包价格。我在这里缺少什么?

package endpoints

import (
    "encoding/json"
    "fmt"
    "github.com/piscean/pricing/price"
    "net/http"
)

func LawnPricing(w http.ResponseWriter, r *http.Request) {

    m, err := price.Pricing()

    c, err := json.Marshal(m)

    w.Write(c)
    r.Body.Close()
}
Run Code Online (Sandbox Code Playgroud)

错误:(gcloud.functions.deploy)OperationError:代码=3,消息=构建失败:/tmp/sgb/gopath/src/serverlessapp/vendor/endpoints/pricing.go:6:2:找不到包“github.com /piscean/pricing/price" 中的任何一个:/tmp/sgb/gopath/src/serverlessapp/vendor/github.com/piscean/pricing/price(供应商树)/go/src/github.com/piscean/pricing/价格(来自 $GOROOT)/tmp/sgb/gopath/src/github.com/piscean/pricing/price(来自 $GOPATH)/tmp/sgb/gopath/src/serverlessapp/vendor/endpoints/zipcode.go:5: 2:在以下任何一个中找不到包“github.com/piscean/pricing/zip”:/tmp/sgb/gopath/src/serverlessapp/vendor/github.com/piscean/pricing/zip(供应商树)/go/src /github.com/piscean/pricing/zip(来自 $GOROOT)/tmp/sgb/gopath/src/github.com/piscean/pricing/zip(来自 $GOPATH)

go google-cloud-platform google-cloud-functions

5
推荐指数
1
解决办法
725
查看次数