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](https://cloud.google.com/functions/docs/writing/specifying-dependencies-go#using_a_vendor_directory) 

Note:

1. 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

```

2. 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

```

3. 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`.