Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.
/ go-essentials Public archive

A containerized development environment for Go, includes automatic code reloads, test running, and vendored dependencies. Powered by Docker.

Notifications You must be signed in to change notification settings

ef2k/go-essentials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-essentials

This is a containerized development environment for Go. It's best suited for those wanting to get up and running quickly. You should have a basic understanding of Docker and Go to make it your own.

How to use this repo

The easiest way to get started is to clone this repo and use it as a starting point.

What you get in the containers

  • Go (1.8)
  • Automatic code reloads (Reflex)
  • Automatic test running (GoConvey)
  • Vendored dependency management (GB)
  • Postgres by default (easily switchable)

Motivation and how it works

The motivation was simple: More executing and less configuring. The other was having reproducible builds that you can easily ship and share with others.

This is how it works.

The development environment runs inside of a Docker container. Your codebase is loaded via a volume, so anytime you make a file change, your application is rebuilt and ran inside the container. In addition to the development tools being containerized, your dependencies are vendored. There are pros and cons to vendoring, but one major pro is having dependable reproducible builds and that outweighs the cons. Last but not least, your test suite is ran inside it's own container. You can then visit http://localhost:8000 for your application and http://localhost:8001 for your tests.

What you need before getting started

  • Docker - To run the Go development, testing, and database containers.

    Tip: Download the latest and greatest: https://www.docker.com/products/overview#/install_the_platform

  • Go - A local install so you can install GB..

    $ gvm install go1.8 -B
    

    Tip: One of the easiest ways to install Go is via GVM (https://github.com/moovweb/gvm).

  • GB - To vendor any dependencies your application will be relying on.

    $ go get github.com/constabulary/gb/...
    

    Tip: Once you have GB installed, start using gb vendor fetch instead of go get. This will update your list of dependencies and add it to vendor/. Here's an example:

    $ gb vendor fetch github.com/pkg/profile
    

How to get started

Assuming you have Docker, Go, and GB installed on your machine, all you need to do is:

$ source config/environments/dev
$ docker-compose up

This will load up environment variables found in config/environments/dev and will then docker-compose up. Leave the terminal open and you'll be able to see all log info.

The server will run on http://localhost:8000

The test suite runs on http://localhost:8001

Tip: Learn all of the other docker-compose commands for greater control.

Special thanks

License

Released under the MIT license.

About

A containerized development environment for Go, includes automatic code reloads, test running, and vendored dependencies. Powered by Docker.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages