- Currently just boot the vagrant image from the just-pikd repo
- Clone this repo into ~/Documents/just-pikd-wms
vagrant ssh
to the dev box- Need to fix permissions via chef, but do this after provisioning:
sudo chown -R vagrant:vagrant /opt/go
- Add to ~/.bashrc (and source it)
export GOPATH='/opt/go'
export PATH=$GOPATH:$PATH - I use gin for live code reloading:
go get github.com/codegangsta/gin
- Dependency management:
go get github.com/tools/godep
- Set cwd to the WMS directory:
cd /opt/go/src/just-pikd-wms
- Install deps:
godep restore
- Run
gin
to start the app, and it should reload when you change code (it can be somewhat slow).
I'm also using GoSublime. I had to set GOPATH and install some packages on my mac to get formatting/syntax highlighting to work. Standardizing that is another TODO item. In GoSublime package settings, I did this:
{
"shell": ["/usr/bin/bash"],
"env": {"GOPATH": "/Users/Scott/go/",
"GOROOT": "/opt/local/go"},
}
Use ./test
to run all tests, or the go test
command to get finer grained control over running individual tests
In the test_data folder, generate_sql.xlsx was used to generate some static records. generate_test_data.sql contains statements based off of that to generate additional data, as well as examples of how to dump it to json files
Code is broken up into subfolders and subpackages for organization:
- config/ contains configuration loading
- controllers/ contains handler functions for each route which parse input, invoke daos and write a response or error
- daos/ contains methods for data access
- Godeps/ doesn't contain go code and is used to vendor dependencies with godep
- integration/ contains integration tests
- models/ contains data models, structs which map to business objects
- public/ contains directly accessible static files, served by the webserver under the /public/ path
- server/ contains the code to set up the webserver including middleware handler, DB connection pool, and the list of routes
- test_data/ contains static files of test data and example scripts to generate test data