0

I have a simple Go app with the following folder structure

-myapp
  -src
    -main
      main.go
      main.yaml
    -mypackage
      mypackage.go
    go.mod

main references mypackage. The go.mod file is simply

module github.com/myname/myapp

go 1.14

I can build the app with go build -o mymain -v ./src/main and everything works.

The issue is when I try to deploy this to Google Application Engine. To deploy I run these commands

export GOPATH=/Users/blah/blah/myapp
gcloud app deploy server.yaml

and I got this error

Staging Flex app: failed analyzing /Users/blah/blah/myapp/src/main: cannot find package "github.com/myname/myapp/src/mypackage" in any of:
    ($GOROOT not set)
    /Users/blah/blah/myapp/src/github.com/myname/myapp/src/mypackage (from $GOPATH)
GOPATH: /Users/blah/blah/myapp

Any idea on what I am doing wrong?

Picci
  • 16,775
  • 13
  • 70
  • 113

1 Answers1

2

It looks like you're using go.mod in an App Engine Flex deployment. Unfortunately, the Flex Go runtime does not support Go modules currently.

To work around the limitation, you can:

Joshua Koh
  • 90
  • 5