Loosely based on go-vue-starter
Install dep to manage the go dependencies and fetch them:
go get -u github.com/golang/dep/cmd/dep
dep ensureThen run docker-compose like:
yes | docker-compose rm && docker-compose up --buildIf you want to run the locally build go app do:
go build && ./go-api -l 2999This will listen on port 2999 alongside an already running docker container.
Install dependencies:
go get -u ./...Go get the migrate CLI.
go get -tags 'postgres' -u github.com/golang-migrate/migrate/cmd/migrateRun the migrations:
migrate -source file://migrations -database postgres://gusta:changeme@localhost:5432/gusta?sslmode=disable upCreate a new migration (e. g. for recipes). This will create up & down files for recipes in the migrations directory.
cd migrations
migrate create -ext sql -dir . -seq -digits 4 recipesTo drop everything and start new do:
migrate -source file://migrations -database postgres://gusta:changeme@localhost:5432/gusta?sslmode=disable dropNote on the migration package: This will probably not be it. Lots of strange behaviors. E. g. using the above command to create a new migration with -dir migrations/ fails in reading the existing files, because it can not convert the path to int. Too bad.