Curyous
Curyous

Reputation: 8866

How do you add an external package to a GoClipse project for Google App Engine?

I've compiled Goauth so that I can use OAuth in my Go Google App Engine project. Where do I put the goauth.a file so that I can both use it in the project, and have it available when deploying to the GAE servers? I can get it working locally if I put it in a subfolder of $GOROOT/pkg, but then it can't be found when compiling at deployment time.

GoClipse sets up a project with lots of folders, I'm not really sure what their purpose is, where should I put goauth.a and how do I import it?

Upvotes: 0

Views: 494

Answers (1)

Curyous
Curyous

Reputation: 8866

To fix this I ended up including the source for the package in the directory tree for my app, as mentioned in this thread on the google-appengine-go group http://groups.google.com/group/google-appengine-go/browse_thread/thread/1fe745debc678afb

Here is the important part of the thread:

You may include as many packages as necessary. Packages are imported by path relative to the base directory (the one that has your app.yaml file), so if you have the following:

helloworld/app.yaml
helloworld/hello/hello.go // package hello
helloworld/world/world.go // package world

you can import "world" in hello and import "hello" in world.

If you are including a third-party library, it might look something like this:

helloworld/app.yaml
helloworld/hello/hello.go // package hello
helloworld/world/world.go // package world
helloworld/goprotobuf.googlecode.com/proto/*.go // package proto

Then you can, as normal, import "goprotobuf.googlecode.com/proto".

Upvotes: 2

Related Questions