Golang-Sample is a sample app that I use to initialise go-lang projects.
Golang-Samples lets you do the following
- Supports multiple binaries
- Uses travis-ci as the primary CI
- Uses Codecov for aggregating test coverage
- Uses dep for dependency management
- Has a Dockerfile to ship the binary in a container
- Has a docker-compose file in external which gives you a postgres, redis and rabbitmq
- Supports 12factorapps
Here are the things that you would require before you get started
- Install git
- Install golang
- Install docker, we use it both for deployment and development
Create a new_project and pull files into it
mkdir new_project
cd new_project
curl -L https://github.com/sudhanshuraheja/golang-sample/archive/master.tar.gz | tar -xzv --strip 1
make build_fresh
Setup postgres
$ cd external
$ docker-compose up
$ tanker migrate
repeat above till you see *Sadly, found no new migrations to run*
If you would like to run the automated tests for the complete package, run this
make coverage
open ./coverage.html
We use the default golang coding conventions. Run the following to test for those
make fmt
make vet
make lint
There is no functionality in this repo and hence cannot be deployed
- DEP - For dependency management
- CLI - For accessing the binary on CLI
- VIPER - For configuration management
- LOGRUS - For logging
- NEGRONI - HTTP Middleware
- MUX - For routing each request to the correct place
- PQ - SQL driver for postgres
- SQLX - For connecting to postgres
- MIGRATE - For migrating postgres
- TESTIFY - For asserting tests
- GO-SQLMOCK - For mocking postgres
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning based on the recommendation from Dave Chaney. For the versions available, see the tags on this repository.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details
- Hat tip to every gopher out there who took the time to write articles so that newbies like me could learn