Google Go AppEngine imports and conflicts when serving / testing

前端 未结 3 1116
清歌不尽
清歌不尽 2020-12-08 23:05

So I have spent the better part of two days trying to figure this one out and no matter what I do I can\'t get things straightened out. Here is what is going on:

    <
3条回答
  •  渐次进展
    2020-12-08 23:41

    I came up with another option that isn't discussed here and in my opinion is much easier to deal with (and keep your app less appengine specific). Lets say you have the repo at github.com/blah/blah and right now the root folder of the repo defines your app engine server.

    First, move the app.yaml and other app engine specific files (NOT .go files) into github.com/blah/blah/appengine/app.yaml.

    Next, wherever you run your init function for app engine, rename it to something like func Run() { ... }, and then in github.com/blah/blah/whatever.go write something like this:

    package appengine
    
    import "github.com/blah/blah"
    
    func init() {
        blah.Run()
    }
    

    From my experience this has resolved the issue and made things much easier. I'll update this if I run into any major issues that make this a bad solution.

提交回复
热议问题