dongyongkui6329 2016-03-24 09:26
浏览 42
已采纳

如何在Golang中将Bundle用于Google App Engine或引用自定义依赖项

Currently I'm using the bunch to do npm style type builds as well as using symbolic links in my web project to be able to do builds without have to pull from a git repository.

For example my directory structure is like the following

testapp/ .vendor -controllers --user_controller.go -routers --router.go -models --user.go server.go Bunchfile

so inside the .vendor/src directory

I also have

.vendor/src/example.com/tgo/testapp/routers

So if i don't want to have to duplicate my folders in the .vendor directory I will use a symbolic link - this works great when I do

ln -s ~/Documents/dev/go/testapp/ ~/Documents/dev/go/testapp/.vendor/src/example.com/tgo/

bunch go build

However for Google App Engine - Trying to see if this will work, haven't been able to figure it out yet.

Here is the code for server.go

package main

import (
  "example.com/tgo/testapp/routers"
  "github.com/codegangsta/negroni"
  "net/http"
  "log"
)

func init(){
  //For Google App Engine
  //settings.Init()
  router :=  routers.InitRoutes()
  n := negroni.Classic()
  n.UseHandler(router)
  http.Handle("/", n)
}
func main() {
  router :=  routers.InitRoutes()
  n := negroni.Classic()
  n.UseHandler(router)
  log.Println("Listening......")
  http.ListenAndServe(":3001", n)

}
  • 写回答

1条回答 默认 最新

  • dswe30290 2016-03-29 05:29
    关注

    I actually figured it out the issue has to do with Assigning $GOPATH before you run the upload to App Engine.

    So I just have a script that sets the environment Variable $GOPATH to the .vendor directory then run goapp serve or goapp deploy and everything works!

    Look forward to moving everything over to app engine!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示