xo-sauce is a command-line tool to optimizes and regenerates Go code generated by xo
Install goimports and xo dependency (if not already installed):
$ go get -u golang.org/x/tools/cmd/goimports
$ go get -u github.com/xo/xo
Then, install in the usual Go way:
$ go get -u github.com/mitu217/xo-sauce
# make an output directory
$ mkdir -p models/xo
# generate code for a postgres schema
$ xo-sauce pgsql://user:pass@host/dbname -o models
$ tree
.
└── models
├── hoge.generated.go
├── hoge.go
└── xo
├── hoge.xo.go
└── xo_db.xo.go