Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed yesterday.
Improve this question
I have below dependencies issues while building my Golang code. These are "unknown revision" , "server certificate verification failed." looks like because of these I am getting "error loading module requirements" error. Can anyone tell me how to resolve such issues in Golang. And what is the immediate fix the below issues?
root#19de6f0192f1:/go/src/example-xapp# go build -a -installsuffix cgo -o example_xapp examples/cmd/example-xapp.go
go: finding github.com/go-redis/redis v6.15.9+incompatible
go: finding github.com/spf13/jwalterweatherman v1.0.0
go: finding github.com/spf13/pflag v1.0.3
go: finding github.com/fsnotify/fsnotify v1.4.9
go: finding github.com/go-openapi/swag v0.19.7
go: finding github.com/prometheus/common v0.4.0
go: finding github.com/go-openapi/strfmt v0.19.4
go: finding github.com/go-openapi/jsonpointer v0.19.3
go: finding k8s.io/utils v0.0.0-20201110183641-67b214c5f920
go: finding google.golang.org/protobuf v1.23.0
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/stretchr/testify v1.5.1
go: finding github.com/go-openapi/validate v0.19.6
go: finding github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084
go: finding github.com/kr/pretty v0.1.0
go: finding github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63
go: finding github.com/go-openapi/swag v0.19.5
go: finding github.com/golang/protobuf v1.4.2
go: finding github.com/docker/go-units v0.4.0
go: finding github.com/stretchr/testify v1.3.0
go: finding gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1
go: finding github.com/pelletier/go-toml v1.2.0
go: finding github.com/vektah/gqlparser v1.1.2
go: finding github.com/spf13/afero v1.2.2
go: finding gopkg.in/alecthomas/kingpin.v2 v2.2.6
go: finding github.com/golang/protobuf v1.2.0
go: finding golang.org/x/sys v0.0.0-20200519105757-fe76b779f299
go: finding gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm v0.5.1-0.20211223104552-f7d2cf80e85c
go: finding gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
go: gopkg.in/alecthomas/kingpin.v2#v2.2.6: unknown revision v2.2.6
go: finding github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: finding gopkg.in/yaml.v2 v2.2.2
go: gopkg.in/yaml.v2#v2.2.2: unknown revision v2.2.2 -------------------------------> issue 1
go: finding github.com/jessevdk/go-flags v1.4.0
go: finding github.com/stretchr/objx v0.2.0
go: gopkg.in/check.v1#v1.0.0-20180628173108-788fd7840127: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /root/go/pkg/mod/cache/vcs/7e5fa1eab4705eb80c9746632736cea906708d060702d529df6241d1c8c2c9f9: exit status 128:
fatal: unable to access 'https://gopkg.in/check.v1/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none ------------------------> issue 2
go: finding github.com/go-logfmt/logfmt v0.3.0
go: finding github.com/matttproud/golang_protobuf_extensions v1.0.1
go: finding golang.org/x/net v0.0.0-20181114220301-adae6a3d119a
go: finding github.com/davecgh/go-spew v1.1.0
go: finding github.com/spf13/viper v1.4.0
go: finding github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d
go: finding github.com/pkg/errors v0.8.0
go: finding github.com/go-openapi/analysis v0.19.5
go: finding github.com/kr/text v0.1.0
go: finding github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
go: finding gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0
go: finding github.com/prometheus/client_golang v0.9.1
go: finding k8s.io/klog/v2 v2.0.0
go: finding github.com/go-openapi/errors v0.19.2
go: finding golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9
go: finding github.com/go-kit/kit v0.8.0
go: finding github.com/mailru/easyjson v0.7.0
go: finding github.com/google/uuid v1.1.1
go: finding github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf
go: finding golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7
go: finding github.com/stretchr/objx v0.1.0
go: finding github.com/go-openapi/jsonreference v0.19.3
go: finding github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
go: finding github.com/prometheus/client_golang v0.9.3
go: finding github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: finding gopkg.in/yaml.v2 v2.2.4
go: gopkg.in/yaml.v2#v2.2.4: unknown revision v2.2.4
go: finding github.com/sirupsen/logrus v1.2.0
go: finding github.com/gorilla/mux v1.7.1
go: finding github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223
go: finding go.mongodb.org/mongo-driver v1.1.2
go: finding golang.org/x/text v0.3.2
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4
go: finding github.com/hashicorp/hcl v1.0.0
go: finding gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.1
go: finding github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
go: finding go.mongodb.org/mongo-driver v1.0.3
go: finding github.com/golang/protobuf v1.4.0
go: finding github.com/beorn7/perks v1.0.0
go: finding github.com/go-openapi/runtime v0.19.4
go: finding github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515
go: finding github.com/stretchr/testify v1.4.0
go: finding golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5
go: finding github.com/gogo/protobuf v1.1.1
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
go: finding github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e
go: finding github.com/julienschmidt/httprouter v1.2.0
go: finding github.com/magiconair/properties v1.8.0
go: finding github.com/google/go-cmp v0.3.0
go: finding github.com/go-openapi/strfmt v0.19.3
go: finding gerrit.o-ran-sc.org/r/com/golog.git v0.0.2
go: finding github.com/tidwall/pretty v1.0.0
go: finding github.com/mitchellh/mapstructure v1.1.2
go: finding github.com/go-stack/stack v1.8.0
go: finding github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
go: finding gopkg.in/yaml.v2 v2.2.1
go: gopkg.in/yaml.v2#v2.2.1: unknown revision v2.2.1
go: finding github.com/google/go-cmp v0.4.0
go: finding github.com/go-openapi/errors v0.19.3
go: finding github.com/go-openapi/spec v0.19.3
go: finding github.com/PuerkitoBio/purell v1.1.1
go: finding gopkg.in/yaml.v2 v2.3.0
go: gopkg.in/yaml.v2#v2.3.0: unknown revision v2.3.0
go: finding github.com/go-openapi/loads v0.19.4
go: finding github.com/spf13/cast v1.3.0
go: finding gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1
go: error loading module requirements ---------------------------------------------> issue 3
root#19de6f0192f1:/go/src/example-xapp#
-- below is the output of "go mod tidy"
root#19de6f0192f1:/go/src/example-xapp# go mod tidy
go: downloading github.com/google/uuid v1.1.1
go: downloading github.com/google/go-cmp v0.4.1
go: extracting github.com/google/uuid v1.1.1
go: downloading github.com/tidwall/pretty v1.0.0
go: extracting github.com/tidwall/pretty v1.0.0
go: downloading gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
go: downloading github.com/BurntSushi/toml v0.3.1
go: downloading github.com/pkg/errors v0.8.1
go: downloading github.com/onsi/ginkgo v1.14.0
go: extracting github.com/google/go-cmp v0.4.1
go: downloading github.com/onsi/gomega v1.10.1
go: extracting github.com/pkg/errors v0.8.1
go: extracting github.com/BurntSushi/toml v0.3.1
go: downloading golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: extracting github.com/onsi/gomega v1.10.1
go: extracting github.com/onsi/ginkgo v1.14.0
go: downloading github.com/nxadm/tail v1.4.4
go: extracting github.com/nxadm/tail v1.4.4
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: extracting golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: extracting gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
go: downloading github.com/kr/pretty v0.1.0
go: extracting github.com/kr/pretty v0.1.0
go: downloading github.com/kr/text v0.1.0
go: extracting github.com/kr/text v0.1.0
go: extracting gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
root#19de6f0192f1:/go/src/example-xapp#
--- adding content of go.mod
root#19de6f0192f1:/go/src/example-xapp# cat go.mod
module gerrit.o-ran-sc.org/r/ric-plt/xapp-frame
go 1.16
require (
gerrit.o-ran-sc.org/r/com/golog v0.0.2
gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm v0.5.1-0.20211223104552-f7d2cf80e85c
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1
gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.1
gerrit.o-ran-sc.org/r/ric-plt/sdlgo v0.7.0
github.com/fsnotify/fsnotify v1.4.9
github.com/go-openapi/errors v0.19.3
github.com/go-openapi/loads v0.19.4
github.com/go-openapi/runtime v0.19.4
github.com/go-openapi/spec v0.19.3
github.com/go-openapi/strfmt v0.19.4
github.com/go-openapi/swag v0.19.7
github.com/go-openapi/validate v0.19.6
github.com/golang/protobuf v1.4.2
github.com/gorilla/mux v1.7.1
github.com/jessevdk/go-flags v1.4.0
github.com/prometheus/client_golang v0.9.3
github.com/prometheus/common v0.4.0
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.5.1
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7
)
require k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.7.0
replace gerrit.o-ran-sc.org/r/com/golog => gerrit.o-ran-sc.org/r/com/golog.git v0.0.2
replace gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common => gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/common v1.2.1
replace gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities => gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/entities v1.2.1
replace gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader => gerrit.o-ran-sc.org/r/ric-plt/nodeb-rnib.git/reader v1.2.1
root#19de6f0192f1:/go/src/example-xapp#
--- output of builing cmd pkg
root#19de6f0192f1:/go/src/example-xapp# go build -a -installsuffix cgo -o example_xapp examples/cmd/example-xapp.go
# gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp
pkg/xapp/mtypes.go:124:41: could not determine kind of name for C.DCAPTERM_GEO_RMR_MSGTYPE
pkg/xapp/mtypes.go:123:41: could not determine kind of name for C.DCAPTERM_RTPM_RMR_MSGTYPE
pkg/xapp/mtypes.go:122:41: could not determine kind of name for C.MC_REPORT
pkg/xapp/mtypes.go:31:41: could not determine kind of name for C.RIC_HEALTH_CHECK_REQ
pkg/xapp/mtypes.go:32:41: could not determine kind of name for C.RIC_HEALTH_CHECK_RESP
pkg/xapp/mtypes.go:47:41: could not determine kind of name for C.RIC_SUB_DEL_REQUIRED
pkg/xapp/mtypes.go:121:41: could not determine kind of name for C.TS_QOE_PREDICTION
pkg/xapp/mtypes.go:120:41: could not determine kind of name for C.TS_QOE_PRED_REQ
pkg/xapp/mtypes.go:119:41: could not determine kind of name for C.TS_UE_LIST
root#19de6f0192f1:/go/src/example-xapp#
--- builing cmd pkg with no file argument
root#19de6f0192f1:/go/src/example-xapp# go build -a -installsuffix cgo -o example_xapp
can't load package: package gerrit.o-ran-sc.org/r/ric-plt/xapp-frame: unknown import path "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame": cannot find module providing package gerrit.o-ran-sc.org/r/ric-plt/xapp-frame
root#19de6f0192f1:/go/src/example-xapp#
I have the following in my docker-build file:
# Runs lint
RUN go get -u golang.org/x/lint/golint
RUN golint ./...
Doing this seems to not work, this is the output I get:
Step 34/38 : RUN go get -u golang.org/x/lint/golint
[01:41:31][Step 2/10] ---> Running in 23acc6d25de3
[01:41:33][Step 2/10] go: finding golang.org/x/lint latest
[01:41:33][Step 2/10] go: downloading golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
[01:41:33][Step 2/10] go: extracting golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
[01:41:33][Step 2/10] go: downloading golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3
[01:41:33][Step 2/10] go: extracting golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3
[01:41:33][Step 2/10] go: downloading golang.org/x/tools v0.0.0-20190624222133-a101b041ded4
[01:41:34][Step 2/10] go: extracting golang.org/x/tools v0.0.0-20190624222133-a101b041ded4
[01:41:34][Step 2/10] go: finding golang.org/x/tools v0.1.3
[01:41:35][Step 2/10] go: downloading golang.org/x/tools v0.1.3
[01:41:35][Step 2/10] go: extracting golang.org/x/tools v0.1.3
[01:41:45][Step 2/10] Removing intermediate container 23acc6d25de3
[01:41:45][Step 2/10] ---> 8bbf3cabfd41
[01:41:45][Step 2/10] Step 35/38 : RUN golint ./...
[01:41:45][Step 2/10] ---> Running in e3fe5ec9e62e
[01:41:45][Step 2/10] /bin/sh: golint: command not found
Thanks Jens! The answer was to either add $GOPATH/bin to path or to just use $GOPATH/bin (which is what I did). In particular the solution was:
# Run lint
RUN go get -u golang.org/x/lint/golint
RUN ${GOPATH}/bin/golint -set_exit_status ./...
I tried with go113 and go111 but none of them works:
Directory structure looks like:
cool_project
- func.go
- func_test.go
utility
- helper.go
fancy
- fancy.go
go.mod # module cool_project
go.sum
.gcloudignore
vendor
...
When I try deploying wiht gcloud functions deploy ... it fails with: cannot find package cool_project/utility or cool_project/fancy.
I had to try with Vendor ebcause go.mod keeps failing with INVALID_ARGUMENT so after Googling around someone pointed this article
Note:
If I deploy with go111 and just the go.mod file (no vendor directory) it fails with cryptic error:
Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: cfb2
go: finding google.golang.org/grpc v1.27.0
go: finding golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5
go: finding github.com/golang/protobuf v1.3.3
go: finding golang.org/x/lint v0.0.0-20200130185559-910be7a94367
go: finding golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7
go: finding golang.org/x/time v0.0.0-20191024005414-555d28b269f0
go: finding google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90
go: finding cloud.google.com/go/bigquery v1.4.0
go: finding golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: finding cloud.google.com/go v0.52.0
go: finding golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74
go: finding golang.org/x/mod v0.2.0
go: finding golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7
go: finding github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473
go: finding golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
go: finding golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6
go: finding golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee
go: finding golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
go: finding github.com/google/go-cmp v0.4.0
go: finding golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8
go: finding golang.org/x/net v0.0.0-20190724013045-ca1201d0de80
go: finding google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1
go: finding golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e
go: finding golang.org/x/tools v0.0.0-20191216173652-a0e659d51361
go: finding golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e
go: finding golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
go: finding golang.org/x/exp v0.0.0-20191129062945-2f5052295587
go: finding golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f
go: finding golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f
go: finding golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: finding golang.org/x/sys v0.0.0-20200122134326-e047566fdf82
go: finding github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
go: finding golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a
go: finding golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a
go: finding google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150
go: finding golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa
go: finding google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba
go: finding golang.org/x/sys v0.0.0-20200113162924-86b910548bc1
go: finding golang.org/x/tools v0.0.0-20200117161641-43d50277825c
go: finding github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc
go: finding golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e
go: finding github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e
go: finding github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1
go: finding github.com/chzyer/logex v1.1.10
go: finding github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6
go: downloading github.com/pkg/errors v0.9.1
go: downloading google.golang.org/api v0.17.0
go: downloading cloud.google.com/go v0.52.0
go: downloading github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575
go: downloading gopkg.in/yaml.v2 v2.2.8
go: downloading cloud.google.com/go/storage v1.5.0
go: downloading cloud.google.com/go/pubsub v1.2.0
go: downloading google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90
go: downloading google.golang.org/grpc v1.27.0
go: downloading github.com/golang/protobuf v1.3.3
go: downloading golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: downloading go.opencensus.io v0.22.3
go: downloading golang.org/x/net v0.0.0-20200202094626-16171245cfb2
go: downloading github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e
go: downloading golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5
go: downloading github.com/googleapis/gax-go/v2 v2.0.5
go: downloading golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
go: downloading github.com/google/go-cmp v0.4.0
# cool_project
files/foo.go:86:69: undefined: "github.com/pkg/errors".Unwrap
files/bar.go:90:70: undefined: "github.com/pkg/errors".Unwrap
And with go113 and go.mod file it is giving not at all helpful error:
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: Build error details not available
Logs shows:
INVALID_ARGUMENT
Ran deploy cmd:
gcloud functions deploy cool_proj113 --trigger-topic test_cool_proj --runtime go113 --entry-point HelloPubSub --source=$PWD/cool_project --verbosity="debug"
DEBUG: (gcloud.functions.deploy) OperationError: code=4, message=Build failed: srv/gopath/src/p/vendor/gcpfun/func.go:21:2: cannot find package "cool_project/fancy" in any of:
/tmp/staging/srv/gopath/src/p/vendor/vendor/cool_project/fancy (vendor tree)
/tmp/staging/srv/gopath/src/p/vendor/cool_project/fancy
/usr/local/go/src/cool_project/fancy (from $GOROOT)
/tmp/staging/srv/gopath/src/cool_project/fancy (from $GOPATH)
srv/gopath/src/p/vendor/gcpfun/func.go:20:2: cannot find package "cool_project/utility" in any of:
/tmp/staging/srv/gopath/src/p/vendor/vendor/cool_project/utility (vendor tree)
/tmp/staging/srv/gopath/src/p/vendor/cool_project/utility
/usr/local/go/src/cool_project/utility (from $GOROOT)
/tmp/staging/srv/gopath/src/cool_project/utility (from $GOPATH)
Traceback (most recent call last):
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 981, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 807, in Run
resources = command_instance.Run(args)
File "/usr/lib/google-cloud-sdk/lib/surface/functions/deploy.py", line 309, in Run
return _Run(args, track=self.ReleaseTrack())
File "/usr/lib/google-cloud-sdk/lib/surface/functions/deploy.py", line 265, in _Run
op, do_every_poll=TryToSetInvokerPermission)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/util.py", line 306, in CatchHTTPErrorRaiseHTTPExceptionFn
return func(*args, **kwargs)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/util.py", line 353, in WaitForFunctionUpdateOperation
do_every_poll=do_every_poll)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/operations.py", line 137, in Wait
_WaitForOperation(client, request, notice, do_every_poll)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/operations.py", line 111, in _WaitForOperation
sleep_ms=SLEEP_MS)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 219, in RetryOnResult
result = func(*args, **kwargs)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/operations.py", line 70, in _GetOperationStatus
raise exceptions.FunctionsError(OperationErrorToString(op.error))
Sigh! FWIW I did test go unit test and things work fine with go113.
I have found 2 (very hacky) ways to fix this issue. My particular case was that I have a private repository that GCP can't access. They say I need to create a vendor directory at the bottom of this page (today):
https://cloud.google.com/functions/docs/writing/specifying-dependencies-go
So I did but then I got the error you're reporting above.
Bad Solution 1:
Put everything in the main directory and rename every package to the entrypoint function's package name.
Hacky Solution 2:
This is literally following the first line of the error:
DEBUG: (gcloud.functions.deploy) OperationError: code=4, message=Build failed: srv/gopath/src/p/vendor/gcpfun/func.go:21:2: cannot find package "cool_project/fancy" in any of:
/tmp/staging/srv/gopath/src/p/vendor/vendor/cool_project/fancy (vendor tree)
In this case do a:
go mod vendor
Then in the vendor directory create a folder with the name of the go mod package name, in your case that would be 'cool_project'. Then copy and paste the subdir folders into that directory (e.g.: vendor/cool_project/fancy/*.go) and then deploy it again.
Which directory are you in when you try to deploy? Are you inside cool_project? You need to make sure you're inside the directory that contains you go.mod file.
I'm trying to upgrade my project to use Go modules for dependency management. I recognize this a new/experimental feature. I'm getting an error: cannot find module providing package.
My go.mod currently reads:
require (
github.com/bugsnag/bugsnag-go v1.5.1
github.com/bwmarrin/discordgo v0.19.0
github.com/jonas747/dshardmanager v0.0.0-20180911185241-9e4282faed43
)
My Dockerfile:
FROM golang:1.12-alpine
RUN mkdir /app
WORKDIR /app
ADD src/ /app
ENV CGO_ENABLED=0
# Building requires git because we're pulling a dependency by commit hash
RUN apk add --no-cache --update git \
&& go build ./... \
&& apk del git
CMD ["/app/main"]
When building, it fails with:
cannot load github.com/bugsnag/panicwrap: cannot find module providing package github.com/bugsnag/panicwrap
When I look at https://github.com/bugsnag/bugsnag-go I don't see a go.mod file. Is this error indicating that this dependency doesn't support modules?
You're doing something wrong, because it works. It does not need a go.mod in order to work with go.mod-based applications:
nrxr at lise in ~/code/src/github.com/nrxr/stack
$ go mod init
go: creating new go.mod: module github.com/nrxr/stack
nrxr at lise in ~/code/src/github.com/nrxr/stack
$ go get github.com/bugsnag/bugsnag-go
go: finding github.com/bugsnag/bugsnag-go v1.5.1
go: downloading github.com/bugsnag/bugsnag-go v1.5.1
go: extracting github.com/bugsnag/bugsnag-go v1.5.1
go: finding github.com/bugsnag/panicwrap v1.2.0
go: downloading github.com/bugsnag/panicwrap v1.2.0
go: finding github.com/gofrs/uuid v3.2.0+incompatible
go: downloading github.com/gofrs/uuid v3.2.0+incompatible
go: extracting github.com/bugsnag/panicwrap v1.2.0
go: extracting github.com/gofrs/uuid v3.2.0+incompatible
go: finding github.com/kardianos/osext latest
go: downloading github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
go: extracting github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
nrxr at lise in ~/code/src/github.com/nrxr/stack
$ cat go.mod
module github.com/nrxr/stack
go 1.12
require (
github.com/bugsnag/bugsnag-go v1.5.1 // indirect
github.com/bugsnag/panicwrap v1.2.0 // indirect
github.com/gofrs/uuid v3.2.0+incompatible // indirect
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
)
Maybe try again? Try with what I just used here.
I am trying to deploy a Go cloud function. I successfully deployed this function to one GCP project, but now when trying to deploy it to another I can't seem to get it to deploy.
I use this command to deploy the function:
gcloud functions deploy Generator --entry-point Generator --memory 512MB --region europe-west1 --runtime go111 --trigger-event google.storage.object.finalize --trigger-resource gs://[redacted].appspot.com --project [redacted]
I am using a go.mod when deploying:
module gitlab.com/[redacted]/[redacted]/[redacted]
require (
cloud.google.com/go v0.35.1
firebase.google.com/go v3.6.0+incompatible
github.com/tdewolff/parse/v2 v2.3.5
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2
google.golang.org/api v0.1.0
)
I get this error message, which is cut off at the interesting part so I can't see what the actual issue is (I think).
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: go: finding github.com/tdewolff/parse/v2 v2.3.5
go: finding golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3
go: finding google.golang.org/api v0.1.0
go: finding golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2
go: finding cloud.google.com/go v0.35.1
go: finding firebase.google.com/go v3.6.0+incompatible
go: finding github.com/tdewolff/test v1.0.0
go: finding golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3
go: finding github.com/BurntSushi/toml v0.3.1
go: finding google.golang.org/genproto v0.0.0-20190122154452-ba6ebe99b011
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
go: finding github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
go: finding github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57
go: finding golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890
go: finding google.golang.org/grpc v1.17.0
go: finding github.com/googleapis/gax-go/v2 v2.0.3
go: finding github.com/golang/mock v1.2.0
go: finding golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b
go: finding github.com/golang/protobuf v1.2.0
go: finding go.opencensus.io v0.18.0
go: finding honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a
go: finding golang.org/x/time v0.0.0-20181108054448-85acf8d2951c
go: finding golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d
go: finding github.com/google/martian v2.1.0+incompatible
go: finding google.golang.org/grpc v1.16.0
go: finding honnef.co/go/tools v0.0.0-20180728063816-88497007e858
go: finding cloud.google.com/go v0.26.0
go: finding golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go: finding golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e
go: finding github.com/golang/mock v1.1.1
go: finding github.com/client9/misspell v0.3.4
go: finding google.golang.org/genproto v0.0.0-20180831171423-11092d34479b
go: finding github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273
go: finding github.com/ghodss/yaml v1.0.0
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: finding golang.org/x/net v0.0.0-20180826012351-8a410e7b638d
go: finding google.golang.org/appengine v1.3.0
go: finding golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
go: finding github.com/matttproud/golang_protobuf_extensions v1.0.1
go: finding github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e
go: finding github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1
go: finding github.com/google/go-cmp v0.2.0
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc
go: finding github.com/stretchr/testify v1.2.2
go: finding golang.org/x/sys v0.0.0-20181029174526-d69651ed3497
go: finding github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371
go: finding github.com/google/go-github v17.0.0+incompatible
go: finding google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf
go: finding github.com/kisielk/gotool v1.0.0
go: finding github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b
go: finding github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50
go: finding github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e
go: finding google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898
go: finding golang.org/x/net v0.0.0-20181106065722-10aee1819953
go: finding golang.org/x/net v0.0.0-20181029044818-c44066c5c816
go: finding golang.org/x/lint v0.0.0-20180702182130-06c8688daad7
go: finding github.com/prometheus/client_golang v0.8.0
go: finding github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568
go: finding github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d
go: finding github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470
go: finding github.com/openzipkin/zipkin-go v0.1.1
go: finding golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852
go: finding github.com/gliderlabs/ssh v0.1.1
go: finding go4.org v0.0.0-20180809161055-417644f6feb5
go: finding dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0
go: finding golang.org/x/text v0.3.0
go: finding gi
How do I get the function to deploy?
After contacting Google I have figured out what the issue is.
The issue is a combination of an error character limit of 4096 characters in Google Cloud Functions wrapper and an artificial timeout for go mod downloads imposed by Google.
The issue can be resolved by vendoring your dependencies as explained here: https://cloud.google.com/functions/docs/writing/specifying-dependencies-go#using_a_vendor_directory