Home > Software engineering >  Deploying Go app on Google Cloud 'missing go.sum entry'
Deploying Go app on Google Cloud 'missing go.sum entry'

Time:11-14

I'm trying to deploy a simple API on Google Cloud using Go 1.19

> go version
go version go1.19.2 windows/amd64

I'm following this documentation as a template to deploy my app. But the deploy fails.

Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build xxx status: FAILURE
go: github.com/go-redis/redis/[email protected] requires
        github.com/onsi/[email protected]: missing go.sum entry; to add it:
        go mod download github.com/onsi/ginkgo

Cloud build log:

Running "go build -o /layers/google.go.build/bin/main . (GOCACHE=/layers/google.go.build/gocache)"
go: github.com/go-redis/redis/[email protected] requires
    github.com/onsi/[email protected]: missing go.sum entry; to add it:
    go mod download github.com/onsi/ginkgo
Done "go build -o /layers/google.go.build/bin/main . (GOCACHE=/lay..." (7.516802ms)
Failure: (ID: 721b15b4) go: github.com/go-redis/redis/[email protected] requires
    github.com/onsi/[email protected]: missing go.sum entry; to add it:
    go mod download github.com/onsi/ginkgo
--------------------------------------------------------------------------------
Running "mv -f /builder/outputs/output-5577006791947779410 /builder/outputs/output"
Done "mv -f /builder/outputs/output-5577006791947779410 /builder/o..." (3.938721ms)
ERROR: failed to build: exit status 1

Running the suggested go mod download github.com/onsi/ginkgo does not solve anything. Also tried go mod tidy as suggested in another posts but same results. Also tried with vendor folder, but nothing again.

This is my app.yaml

runtime: go116

go.mod

module notams/anac
go 1.19

require (
    github.com/go-redis/redis/v9 v9.0.0-rc.1
    github.com/gorilla/mux v1.8.0
    github.com/joho/godotenv v1.4.0
    golang.org/x/exp v0.0.0-20221019170559-20944726eadf
)

require (
    github.com/cespare/xxhash/v2 v2.1.2 // indirect
    github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
)

go.sum

github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3 rkHYY13jYWTU97c=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz 1KgoB3wDUb6vlszIc=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa /V/PDsU6CfLf6CNO8H7IWoS4=
github.com/go-redis/redis/v9 v9.0.0-rc.1 h1:/ bS yeUnanqAbuD3QwlejzQZ 4eqgfUtFTG4b QnXs=
github.com/go-redis/redis/v9 v9.0.0-rc.1/go.mod h1:8et z03j0l8N DvsVnclzjf3Dl/pFHgRk 2Ct1qw66A=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/joho/godotenv v1.4.0 h1:3l4 N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/gomega v1.21.1 h1:OB/euWYIExnPBohllTicTHmGTrMaqJ67nIu80j0/uEM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1 rVB AZJydKsMxsQBIJw4PKk=
golang.org/x/exp v0.0.0-20221019170559-20944726eadf h1:nFVjjKDgNY37 ZSYCJmtYf7tOlfQswHqplG2eosjOMg=
golang.org/x/exp v0.0.0-20221019170559-20944726eadf/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a 7czfdQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

EDIT 1: Already tried to change runtime: go and to runtime: go119 but those are not supported and return "invalid go runtime".

CodePudding user response:

To anyone who might have this problem, I just deployed the app on Cloud Run instead of App Engine and everything runs smoothly. I was not able to deploy it on App Engine and i think that the only way to do so is adapting the code and modules to the latest runtime version available for GCP (currently Go 1.16).

  • Related