English 中文(简体)
如何进口当地人员 摘录
原标题:How to import local Go package in GAE

How to import local packages in Golang + GAE?

anna:

app/
-app.yaml
-/my_app
--my_app.go
--/package1
---package1.go

我的提名:

package my_app

import (
  "http"
  "./package1"
)

func init() {
  http.HandleFunc("/", package1.index)
}

列出包裹1.go:

package package1

import (
  "http"
  "fmt"
)

func index (w http.ResponseWriter, r * http.Request) {
  fmt.Fprint(w, "I m index page =) ")
}

我有这样的错误:

/path/to/project/my_app/my_app.go:5: can t find import: ./package1
2011/11/03 10:50:51 go-app-builder: Failed building app: failed running 6g: exit status 1

得到帮助。

最佳回答

You要么需要将包件与您的申请目录链接或复制。 与申请目录的根基相对的道路应当与进口路线相吻合。 为了使用一揽子方案1,你应当把你的表相仿:

app.yaml
yourapp/yourapp.go
package1/package1.go

from https://groups.google.com/d/msg/golang-nuts/coEvrWIJGTs/75GzcefKVcIJ

问题回答

如关于oxy子回答的评论所指出,在特定情况下进口当地包裹的办法是作为my_app/ Pack1>进口:

import (
    "http"
    "my_app/package1"
)




相关问题
How to make logging.debug work on Appengine?

I m having a tough time getting the logging on Appengine working. the statement import logging is flagged as an unrecognized import in my PyDev Appengine project. I suspected that this was just an ...

gqlQuery returns object, want list of keys

Is there a way to convert the GqlQuery object to an array of keys, or is there a way to force the query to return an array of keys? For example: items = db.GqlQuery("SELECT __key__ FROM Items") ...

Integrating Google AppEngine with a Thick Client

I want to make a multi-user client-server solution with Java Swing thick client as a front-end and Google AppEngine (Java one) as a back-end. The problem is that GAE provides only web-based forms for ...

sorl.thumbnail : thumbnail is not a valid tag library?

I am trying to install sorl.thumbnail but am getting the following error message: thumbnail is not a valid tag library: Could not load template library from django.templatetags.thumbnail, No module ...

热门标签