Skip to content

sudhanshuraheja/golang-sample

Repository files navigation

Sample

Golang-Sample is a sample app that I use to initialise go-lang projects.

Getting Started

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

Prerequisites

Here are the things that you would require before you get started

  1. Install git
  2. Install golang
  3. Install docker, we use it both for deployment and development

Installing

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*

Running the tests

If you would like to run the automated tests for the complete package, run this

make coverage
open ./coverage.html

And coding style tests

We use the default golang coding conventions. Run the following to test for those

make fmt
make vet
make lint

Deployment

There is no functionality in this repo and hence cannot be deployed

Built With

  • 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

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning based on the recommendation from Dave Chaney. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details

Acknowledgments

  • Hat tip to every gopher out there who took the time to write articles so that newbies like me could learn

About

Golang sample app that I use for my own projects

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published