I'm trying to build my go application using serverless framework
in cloudbuild.
Here's my project structure
/api
/giam
go.mod
API.go
/other_folders...
/util
go.mod
util.go
Here's my build steps:
steps:
- name: 'gcr.io/cloud-builders/npm'
args: ['install']
- name: 'softinstigate/serverless'
args: ['deploy', '-v']
dir: 'api/giam'
env: ['PROJECT_ROOT=${REPO_NAME}', 'GO111MODULE=on']
and here's my go.mod
in api/giam
module mybackend
require bitbucket.org/myusername/mybackend/util v0.0.0
replace bitbucket.org/myusername/mybackend/util => /workspace/util
and I confirmed that I have a go.mod
in my util
folder.
and here's the content
module util
require cloud.google.com/go v0.37.1
The error
I got this error while running the cloudbuild..
{"ResourceType":"cloudfunctions.v1beta2.function","ResourceErrorCode":"400","ResourceErrorMessage":"Build failed: go: parsing util/go.mod: open /workspace/util/go.mod: no such file or directory
go: error loading module requirements
"}
if I got this right, the error is that it cannot find the /workspace/util/go.mod
I tried ls
in the cloudbuild, specifically in /workspace/util
and I found the go.mod
file.
I'm pretty stuck here.. I don't know what to do next..