Blixt
Blixt

Reputation: 50169

I can't deploy a Go module to App Engine using the google.golang.org/appengine modules

From the latest material I can read, and also based on documentation on certain APIs (for example, the Go Datastore API), I'm supposed to use google.golang.org/appengine etc. instead of the old appengine/... paths. However, when I try to deploy using gcloud preview app deploy, I get the following error:

Deployment contains files that cannot be compiled: Compile failed:

2016/01/14 14:32:43 go-app-builder: build timing: 2×6g (113ms total), 0×6l (0 total)
2016/01/14 14:32:43 go-app-builder: failed running 6g: exit status 1

server/alexa.go:10: can't find import: "golang.org/x/net/context"

The golang.org/x/net/context package supposedly replaces the old appengine/context one, but it doesn't appear to be available in the deployment server's GOROOT.

I tried including all the dependencies and their dependencies in my package repo but that only lead me to this obscure error (the directory it's complaining about actually exists):

Deployment contains files that cannot be compiled: Compile failed:

2016/01/14 14:27:04 go-app-builder: build timing: 18×6g (1.819s total), 0×6l (0 total)
2016/01/14 14:27:04 go-app-builder: failed running 6g: exit status 1

github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go:27: can't find import: "github.com/golang/protobuf/protoc-gen-go/testdata/multi"

Have I misunderstood the documentation and am only supposed to use the old packages?

Upvotes: 4

Views: 3963

Answers (3)

kendo5731
kendo5731

Reputation: 243

For the record, this issue is now fixed with gcloud version 142. One should now be able to deploy using gcloud beta app deploy --project <project> app.yaml. Use gcloud components update to upgrade the command line.

Upvotes: 0

user7180
user7180

Reputation: 4066

If you are using gosdk, just run goapp get in the same directory as your .go file and it will download and install the dependencies to your gosdk installation. You then deploy the app again and it should compile without problem.

When it's working there's no prompt and files will be downloaded to gosdk\gopath\src

After fininshing there will be a warning message which can be ignored:

go install: no install location for directory C:\your_current_directory outside GOPATH For more details see: go help gopath

Upvotes: 1

Sean
Sean

Reputation: 1088

You need to do a go get golang.org/x/net/context to save that package in your go src directory. Though, when working with App Engine it is not necessary. Those libraries can be imported and used, but they mostly focused on applications run outside of App Engine, i.e. Container Engine or Compute Engine. They essentially hook into the RESTful APIs Google cooked up for those services. If you decide to work directly with Google Cloud Storage you would need those libraries since App Engine expects you to use Blobstore instead. Hope this helps.

Upvotes: 2

Related Questions