douya8978 2019-02-23 13:31
浏览 131

使用Go 1.11,Google Cloud Storage和Go模块的Google Cloud Platform功能部署失败

I'm trying to create a function for the google cloud platform cloud functions. The trigger type is Cloud Pub/Sub and the topic is cloud-builds. I know this function is very basic, I'm just trying to get to a point where the function builds. In my full function I need to use google cloud storage. The runtime is Go 1.11.

function.go content source:

// Package p contains a Pub/Sub Cloud Function.
package p

import (
    "context"
    "log"    
    "cloud.google.com/go/storage"
)

// PubSubMessage is the payload of a Pub/Sub event. Please refer to the docs for
// additional information regarding Pub/Sub events.
type PubSubMessage struct {
    Data []byte `json:"data"`
}

// HelloPubSub consumes a Pub/Sub message.
func HelloPubSub(ctx context.Context, m PubSubMessage) error {
    log.Println(string(m.Data))
    return nil
}

When building with the "cloud.google.com/go/storage" dependency the go build process should update the go.mod file but the process never finishes successfully.

The failure message:

Deployment failure:

Build failed: go: finding cloud.google.com/go/storage latest
go: finding cloud.google.com/go v0.36.0
go: downloading cloud.google.com/go v0.36.0
go: finding github.com/google/martian v2.1.0+incompatible
go: finding github.com/golang/protobuf v1.2.0
go: finding github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
go: finding github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57
go: finding go.opencensus.io v0.18.0
go: finding golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d
go: finding golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2
go: finding golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
go: finding honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a
go: finding github.com/google/go-cmp v0.2.0
go: finding golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890
go: finding golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
go: finding google.golang.org/grpc v1.17.0
go: finding github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: finding github.com/openzipkin/zipkin-go v0.1.1
go: finding golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3
go: finding google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922
go: finding github.com/googleapis/gax-go/v2 v2.0.3
go: finding google.golang.org/genproto v0.0.0-20180831171423-11092d34479b
go: finding github.com/golang/mock v1.1.1
go: finding github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273
go: finding git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999
go: finding golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b
go: finding golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go: finding github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: finding github.com/prometheus/client_golang v0.8.0
go: finding cloud.google.com/go v0.26.0
go: finding golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52
go: finding google.golang.org/appengine v1.1.0
go: finding github.com/client9/misspell v0.3.4
go: finding github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625
go: finding github.com/ghodss/yaml v1.0.0
go: finding google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9
go: finding github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2
go: finding google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
go: finding dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0
go: finding golang.org/x/text v0.3.0
go: finding github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568
go: finding github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537
go: finding github.com/golang/mock v1.2.0
go: finding golang.org/x/exp v0.0.0-20190121172915-509febef88a4
go: finding github.com/google/go-github v17.0.0+incompatible
go: finding dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c
go: finding github.com/gliderlabs/ssh v0.1.1
go: finding github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1
go: finding github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86
go: finding golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
go: finding golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16
go: finding github.com/stretchr/testify v1.2.2
go: finding github.com/kr/pretty v0.1.0
go: finding google.golang.org/grpc v1.14.0
go: finding github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239
go: finding github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d
go: finding golang.org/x/sys v0.0.0-20181029174526-d69651ed3497
go: finding github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab
go: finding github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95
go: finding github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d
go: finding github.com/BurntSushi/toml v0.3.1
go: finding github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1
go: finding go4.org v0.0.0-20180809161055-417644f6feb5
go: finding github.com/shurcooL/

Including "require cloud.google.com/go v0.36.0" before building yields a similar failure message.

When doing this locally, go build producing a similar message in my terminal:

go: finding cloud.google.com/go/storage latest
go: finding cloud.google.com/go v0.36.0
go: downloading cloud.google.com/go v0.36.0
go: finding github.com/google/martian v2.1.0+incompatible
go: finding github.com/golang/mock v1.2.0
go: finding github.com/googleapis/gax-go/v2 v2.0.3
go: finding github.com/google/go-cmp v0.2.0
go: finding golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890
go: finding golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d
go: finding google.golang.org/api v0.1.0
go: finding golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3
go: finding google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922
go: finding golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b
go: finding github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
go: finding google.golang.org/grpc v1.17.0
go: finding github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57
go: finding golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
go: finding honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a
go: finding golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
go: finding github.com/BurntSushi/toml v0.3.1
go: finding google.golang.org/grpc v1.16.0
go: finding github.com/golang/protobuf v1.2.0
go: finding go.opencensus.io v0.18.0
go: finding golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
go: finding cloud.google.com/go v0.26.0
go: finding honnef.co/go/tools v0.0.0-20180728063816-88497007e858
go: finding github.com/client9/misspell v0.3.4
go: finding github.com/golang/lint v0.0.0-20180702182130-06c8688daad7
go: finding github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: finding golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
go: finding golang.org/x/lint v0.0.0-20180702182130-06c8688daad7
go: finding github.com/golang/mock v1.1.1
go: finding github.com/kisielk/gotool v1.0.0
go: finding golang.org/x/net v0.0.0-20180826012351-8a410e7b638d
go: finding github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e
go: finding github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273
go: finding golang.org/x/exp v0.0.0-20190121172915-509febef88a4
go: finding github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: finding golang.org/x/net v0.0.0-20181106065722-10aee1819953
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e
go: finding golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go: finding github.com/matttproud/golang_protobuf_extensions v1.0.1
go: finding google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf
go: finding golang.org/x/net v0.0.0-20180906233101-161cd47e91fd
go: finding google.golang.org/genproto v0.0.0-20180831171423-11092d34479b
go: finding golang.org/x/text v0.3.0
go: finding google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
go: finding git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999
go: finding google.golang.org/grpc v1.14.0
go: finding github.com/prometheus/client_golang v0.8.0
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: finding github.com/openzipkin/zipkin-go v0.1.1
go: finding github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
go: finding google.golang.org/appengine v1.1.0
go: finding github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50
go: finding github.com/stretchr/testify v1.2.2
go: finding github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122
go: finding github.com/davecgh/go-spew v1.1.1
go: finding grpc.go4.org v0.0.0-20170609214715-11d0a25b4919
go: finding github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d
go: finding github.com/kr/pretty v0.1.0
go: finding github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9
go: finding github.com/grpc-ecosystem/grpc-gateway v1.5.0
go: finding github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1
go: finding github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86
go: finding github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
go: finding gopkg.in/inf.v0 v0.9.1
go: finding github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48
go: finding github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c
go: finding github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7
go: finding dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0
go: finding github.com/kr/text v0.1.0
go: finding github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3
go: finding github.com/kr/pty v1.1.3
go: finding github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e
go: finding github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d
go: finding sourcegraph.com/sourcegraph/go-diff v0.5.0
go: finding dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c
go: finding golang.org/x/sys v0.0.0-20181029174526-d69651ed3497
go: finding github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d
go: finding google.golang.org/appengine v1.2.0
go: finding github.com/ghodss/yaml v1.0.0
go: finding github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239
go: finding github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371
go: finding github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625
go: finding github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537
go: finding github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191
go: finding google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2
go: finding github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133
go: finding golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52
go: finding github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e
go: finding golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4
go: finding golang.org/x/net v0.0.0-20180724234803-3673e40ba225
go: finding github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20
go: finding github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2
go: finding github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82
go: finding golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2
go: finding github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241
go: finding google.golang.org/api v0.0.0-20181030000543-1d582fd0359e
go: finding github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470
go: finding github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1
go: finding github.com/kr/pty v1.1.1
go: finding github.com/fsnotify/fsnotify v1.4.7
go: finding github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab
go: finding github.com/google/go-querystring v1.0.0
go: finding sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4
go: finding github.com/googleapis/gax-go v2.0.0+incompatible
go: finding github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9
go: finding github.com/gliderlabs/ssh v0.1.1
go: finding github.com/gogo/protobuf v1.1.1
go: finding cloud.google.com/go v0.31.0
go: finding github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b
go: finding dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412
go: finding go4.org v0.0.0-20180809161055-417644f6feb5
go: finding golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16
go: finding github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95
go: finding github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568
go: finding github.com/dustin/go-humanize v1.0.0
go: finding github.com/microcosm-cc/bluemonday v1.0.1
go: finding github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4
go: finding github.com/russross/blackfriday v1.5.2
go: finding github.com/sergi/go-diff v1.0.0
go: finding golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852
go: finding github.com/google/go-github v17.0.0+incompatible
go: finding golang.org/x/net v0.0.0-20181029044818-c44066c5c816
go: finding github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041
go: finding google.golang.org/appengine v1.3.0
go: finding google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898
go: downloading google.golang.org/api v0.1.0
go: downloading google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922
go: downloading github.com/googleapis/gax-go v2.0.0+incompatible
go: downloading google.golang.org/grpc v1.17.0
go: downloading github.com/googleapis/gax-go/v2 v2.0.3
go: downloading go.opencensus.io v0.18.0
go: downloading github.com/golang/protobuf v1.2.0
go: downloading golang.org/x/sys v0.0.0-20181029174526-d69651ed3497
go: downloading golang.org/x/net v0.0.0-20181106065722-10aee1819953
go: downloading golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2
go: downloading golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890

and the go.mod file is correctly modified to include the line "require cloud.google.com/go v0.36.0"

I'm just trying to use google cloud storage in my cloud function. If someone could tell me how to do this that would be awesome, I'm probably being silly!

It's like when built in cloud functions the build has a timeout and stops before it finishes.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog