My app works fine using Appengine's development software. When I try to deploy, I get this error:
main.go:11: can't find import: "github.com/afoo/cohort/models"
My folder structure looks like this, where afoo is a subdirectory of a "standard" src/github.com setup, referenced in the GOPATH:
The app.yaml file is quite simple:
application: application-id
version: 1
runtime: go
api_version: go1
handlers:
- url: /styles
static_dir: styles
- url: /scripts
static_dir: scripts
- url: /.*
script: _go_app
The main.go file has the URL handler funcs I've defined, for instance:
func init() {
// Register a handler for /.
http.HandleFunc("/", MapNetworkHandler)
}
Module imports in main.go are fully qualified, and look like this:
"github.com/afoo/cohort/models"
Google groups has a long discussion from 2014 that attempts to explain the proper folder setup. It's located here:
From that discussion, I learned that I need to separate all modules (here, models, repository, and utils) from the main folder. But then there are some confusing mentions of other .yaml files that should go into each module folder, with no description of how they look, along with allusions to a skeleton init (.go) file that somehow imports everything else.
For better or worse, I learn by example, and I can't find a good example that would help me. I'd sure appreciate any detailed explanation of the proper folder structures and supplementary files that someone might know about.
Thanks for any help!