eclipse - 如何将外部包添加到 Google App Engine 的 GoClipse 项目?

标签 eclipse google-app-engine go

我编译了 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 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".

关于eclipse - 如何将外部包添加到 Google App Engine 的 GoClipse 项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7535803/

相关文章:

android - Eclipse Android 项目因意外运行 XML 而中断

eclipse - ActionScript-Eclipse/FlashBuilder : How do I change the color of/prevent the selection of matching selected text?

java - GAE - 当我部署应用程序时不起作用,但在本地主机上它有效吗?

google-app-engine - 应用程序.yaml : wildcard in URL with static_dir?

json - 在 Go 中从具有未知键值的 JSON 创建字符串映射

javascript - 从服务器发送 JSON 需要 JSON.parse 两次

Java 插件 "There is no site selected"对此有什么想法吗?

java - 批量获取 map 迭代需要 200 毫秒

google-app-engine - 数据存储 API 调用与数据存储查询

string - 如何删除字符串的第一个字符?