我编译了 Goauth,这样我就可以在我的 Go Google App Engine 项目中使用 OAuth。我应该把 goauth.a 文件放在哪里,这样我既可以在项目中使用它,又可以在部署到 GAE 服务器时使用它?如果我把它放在 $GOROOT/pkg 的子文件夹中,我可以让它在本地工作,但是在部署时编译时找不到它。
GoClipse 设置了一个包含很多文件夹的项目,我不太确定它们的用途是什么,我应该把 goauth.a 放在哪里以及如何导入它?
最佳答案
为了解决这个问题,我最终在我的应用程序的目录树中包含了包的源代码,正如 google-appengine-go 组 http://groups.google.com/group/google-appengine-go/browse_thread/thread/1fe745debc678afb 上的这个线程中提到的那样
这是线程的重要部分:
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 worldyou 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 protoThen you can, as normal, import "goprotobuf.googlecode.com/proto".
关于eclipse - 如何将外部包添加到 Google App Engine 的 GoClipse 项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7535803/