
GoX (0.3 alpha)
GoX is a go tool, to build and run your go server application in a docker container.
Install
go get github.com/maprost/gox
Actions
gox init
/ gox
- init all dependencies in docker container for your test environment
- it's mainly to run your tests in IntelliJ or at the terminal
- default behavior of
gox
.
gox build
- run
godep [save|update] ./...
, if activated (-godep
)
- check style in a docker container, build failed if
-style
is activated and there are some check style warnings
go vet
golint
gocyclo
, check cyclomatic complexities of functions in Go source code (shouldn't be higher than 10)
- compile your project in a docker container
- test your project in a docker container (therefor init all dependencies)
- build docker image
- build a shell script for the server, if activated (
-shell
)
- build a docker compose script for the server, if activated (
-compose
)
- additional commands:
-config
: set the config, the project need in the docker image
-testconfig
: set the config for the build container and testing
gox binrun
- this mode exists mostly for local testing
- build a binary of your project
- init all dependencies, if not deactivated (
-fast
)
- run the binary
- additional commands:
-config
: set the config, the project need in the docker image
- see all states of your docker container/images
- pull all needed docker images (
-pull
)
- clean your docker images (
-clean
)
- build a travis ci script (
-travis
)
Supported Databases
Planned Databases
- MySql
- Google Cloud Datastore
- MongoDB
Dependencies
- docker (has to be installed on the system)
- godep (has to be installed
go get github.com/tools/godep
)
- golint (will be downloaded into a docker container and execute)
- gocyclo (will be downloaded into a docker container and execute)
Config
type config struct {
Port string // mandatory, port of server (optional for test config)
Docker struct { // optional, if not set -> don't use a docker container (be careful -> paths depend on build system)
Container string // optional, default: name of project
Image string // optional, default: golang:latest
Volume []string // optional, public resource folder like: html, css, images...
}
Databases []struct { // optional,
Driver string // mandatory, driver of your database ['postgres']
Dbname string // mandatory, name of the used database
User string // mandatory
Password string // optional, default: ''
Host string // optional, default: localhost
Port string // optional, default: std port of db
Docker struct { // optional, if not set -> database is not in a docker container
Container string // optional, default: Driver+Port
Image string // optional, default: Driver:latest
Discspace string // optional, for mode hdd mandatory
}
}
Property map[string]string // optional, some input like client urls or keys
}