appengine
appengine copied to clipboard
Add normal support for standart environment vendoring
Following app engine golang tutorial it is simply to run hello world app https://github.com/GoogleCloudPlatform/appengine-guestbook-go/tree/part1-helloworld
main.go
package hello
import (
"fmt"
"net/http"
)
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello, world!")
}
app.yaml
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
In hello world when I run dev_appserver.py app.yaml
I'm getting service up and running. But If I add any vendor like golang echo and use dep
to vendor app libraries then it is not building and I'm getting errors
Failed parsing input: parser: bad import "syscall" in vendor/golang.org/x/sys/unix/syscall_unix.go
This issue is also posted on https://stackoverflow.com/questions/39948027/how-do-i-make-vendoring-work-with-google-app-engine/40118834#40118834
I was able to run it using this approach https://github.com/nikolay-turpitko/x-gae-dep but it looks like a workaround. Is it possible to somehow run app locally and deploy it from my current GOPATH or I'm forced to adapt to google-cloud-sdk GOPATH?
@broady From commits history I see that you are active contributor. Maybe you have any estimates or comments on this?
@anjmao I'm having the same issue, cloud you find a clean solution than the workaround?
FWIW, I've run into the same issue. Basically, I had a Go (1.11) app in the standard environment. I was developing locally, and using dev_appserver.py
was working fine. However, I ran into several issues when trying to actually deploy with gcloud app deploy app.yaml
. I got the same error as you:
Deployment contains files that cannot be compiled: Compile failed: Failed parsing input: parser: bad import "unsafe" in vendor/golang.org/x/sys/unix/affinity_linux.go
I was pretty sure this wasn't a vendoring issue on my end, since I'd previously had errors about vendoring but had resolved those issues by using govendor and making sure my project hierarchy was correct. This new error looked like an issue on GAE's end.
Anyway, I fixed this specific issue by upgrading my Go runtime in app.yaml from the default go1
to go111
. My app.yaml now looks like:
runtime: go111
handlers:
- url: /.*
script: auto
TLDR: Upgrading the Go runtime seemed to fix this issue for me.