Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

gcloud app deploy with updates is giving me "pattern ./...: directory . outside main module...

Hi all,

I am going to try to be as deliberate as possible here. I have a backend to a website that I am hosting with Google App Engine. Everything was working great, until I went to write some new code to present the website with new functionality. Well, while writing in VSCode I got everything to execute perfectly. When uploading my front end to my Google Cloud Storage Bucket, I had no issues. But when uploading my new code to Google App Engine (via the Google Cloud Shell Editor) and running `gcloud app deploy`, I am met with an error in the Cloud Shell Editor console that says,

"Error Response: [9] Cloud build fcea6735-b6d4-4170-bf11-47e5c732fe6f status: FAILURE
pattern ./...: directory gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.1/spew outside main module or its selected dependencies".

I am very stumped on this, as I've tried my best to scour what resources I could for help regarding this topic, but I have not been able to find anything to get me out of this hole.

Lastly, the error message from Google Cloud Shell Editor also tells me to visit a page for the full logs. Below is the error message spit out by that page on Step #2: Build, 

"Step #2 - "build": Running "go list -f {{join .Imports \"\\n\" }} ./..."

Step #2 - "build": pattern ./...: directory gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.1/spew outside main module or its selected dependencies
Step #2 - "build": Done "go list -f {{join .Imports \"\\n\" }} ./..." (363.74608ms)
Step #2 - "build": Failure: (ID: 310b0f99) pattern ./...: directory gopath/pkg/mod/github.com/davecgh/go-spew@v1.1.1/spew outside main module or its selected dependencies
Step #2 - "build": --------------------------------------------------------------------------------
Step #2 - "build": Running "mv -f /builder/outputs/output-6530748475564727901 /builder/outputs/output"
Step #2 - "build": Done "mv -f /builder/outputs/output-6530748475564727901 /builder/o..." (20.584911ms)
Step #2 - "build": ERROR: failed to build: exit status 1
Finished Step #2 - "build"
ERROR"
 
Please let me know if there is any more information I could provide for anyone to help me. I am newer to the forum scene and the Google Cloud scene so please bear with me. Thanks in advance!
Solved Solved
0 1 566
1 ACCEPTED SOLUTION

Hello @bendoza,

Welcome to the Google Cloud Community!

It seems that you are having a problem with the deployment process of your application, specifically with your package dependency.

Take a look at this documentation about Specifying Dependencies

You can try the following troubleshooting options:

  1. Make sure that all your import statements in your Go code specify absolute paths, for example:
    import "github.com/example/mypackage"
  2. It is recommended to use Go modules to manage dependencies in your Go app, but you can use the older GOPATH mode if you haven't migrated to Go modules yet.
  3. Check out this guide when using Go modules.
  4. App Engine cannot download your private dependencies during the build process, so you must include them with your application code when you deploy. See Using private dependencies.
  5. If the above options don't work, you can contact Google Cloud Support to further look into your case.

Let me know if it helped, thanks!

View solution in original post

1 REPLY 1

Hello @bendoza,

Welcome to the Google Cloud Community!

It seems that you are having a problem with the deployment process of your application, specifically with your package dependency.

Take a look at this documentation about Specifying Dependencies

You can try the following troubleshooting options:

  1. Make sure that all your import statements in your Go code specify absolute paths, for example:
    import "github.com/example/mypackage"
  2. It is recommended to use Go modules to manage dependencies in your Go app, but you can use the older GOPATH mode if you haven't migrated to Go modules yet.
  3. Check out this guide when using Go modules.
  4. App Engine cannot download your private dependencies during the build process, so you must include them with your application code when you deploy. See Using private dependencies.
  5. If the above options don't work, you can contact Google Cloud Support to further look into your case.

Let me know if it helped, thanks!