小编sam*_*awy的帖子

尝试使用go模块在Go 1.11中部署Google云功能时出错

我在尝试使用Go模块在Go 1.11中部署Google云功能时遇到问题.我的代码结构如下GOPATH:

??? example
    ??? models
    ?   ??? go.mod
    ?   ??? models.go
    ??? load
        ??? fn.go
        ??? go.mod
        ??? go.sum
        ??? vendor
            ??? ....
Run Code Online (Sandbox Code Playgroud)

load/go.mod如下所示:

module github.com/example/load

require (
    github.com/example/models v0.0.0
)

replace github.com/example/models => ../models
Run Code Online (Sandbox Code Playgroud)

当我尝试使用该命令部署该功能时

gcloud functions deploy load-data --entry-point GCSNewFileTrigger --runtime go111 --trigger-resource new_data --trigger-event google.storage.object.finalize
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

Deploying function (may take a while - up to 2 minutes)...failed.                                                                                                                                                                     
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: go: parsing /models/go.mod: open /models/go.mod: no such file or directory
go: …
Run Code Online (Sandbox Code Playgroud)

go google-cloud-platform google-cloud-functions go-modules

6
推荐指数
1
解决办法
1117
查看次数