Thursday, November 6, 2014

Layout Structure for a Go Web Project

I wanted to create my first Go web application on App Engine but wasn't sure how to structure my project.

The first step in laying out my project involved reading the following articles:
I wanted to follow the guidelines as described in the "How to Write Go Code" document but also create my project in a way that would be easy to build a web application that can be deployed on App Engine. I decided to split my website into two git repositories.
The first repo would be the website itself and all associated code. This app is responsible for handling requests and saving data to the datastore. The second repository would contain my business logic that would be used for the website as a library. The reason for separating the business logic is that the library may be used in other applications, other than a web app.
I eventually ended up with the following project structure:
├── projects
    ├── bin
    ├── pkg
    ├── src
            ├── alexchan
                ├── careermatchme
                │   ├── setup.txt
                │   └── web
                │       ├── app.go
                │       ├── app.yaml
                │       ├── static
                │       │   ├── css
                │       │   ├── img
                │       │   └── js
                │       └── templates
                │           ├── 404.html
                │           ├── 500.html
                │           ├── base.html
                │           └── jobsearch
                │               ├── about.html
                │               ├── includes
                │               │   ├── pagination.html
                │               └── search
                │                   ├── form.html
                │                   └── results.html
                └── jobs
                    ├── jobs.go
                    └── jobs_test.go
The top-level directory, projects, is where my Go workspace and is where my GOPATH environment variable is set to. My two repositories are under and This allowed me to follow to conventions of described in the first article while setting up my environment to also develop and deploy for App Engine.


  1. Your blog is nice. I believe this will surely help readers who are really in need of this vital piece of information. Thanks for sharing and kindly keep updating.

    IELTS Classes in Mumbai
    IELTS Coaching in Mumbai
    IELTS Mumbai
    Best IELTS Coaching in Mumbai
    IELTS Center in Mumbai

  2. How to win at the Casinos Near Lucky Eagle Casino & Hotel
    Casinos 광주광역 출장마사지 Near Lucky Eagle Casino & Hotel · 춘천 출장마사지 1. Hollywood Blvd. 순천 출장안마 South, Las 서산 출장안마 Vegas, NV 89109 · 2. Bellagio, NV 89109 · 3. Bally's, CA 95117 · 4. Ameristar Park, 김포 출장샵 IL 98139.