Skip to content

groovili/go-wagen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-wagen

Go Report Card

Single binary web application generator for Go.

Creates boilerplate and does routine on a project start.

Less than in a minute you've got simple, clean and dockerized app:

asciicast

Generates:

  • project layout, according to community best practices
  • Makefile for wrapping project related routines
  • Dockerfile and docker-compose for local development
  • containers for code, tests and golangci-lint
  • configuration management with viper
  • logging with logrus or zap
  • routing with gorilla/mux or chi
  • default health check, http handler and logger middleware

go-wagen is a starter pack for typical web application in Golang.

It doesn't aim to generalize the whole project workflow, push framework, or architecture. Consists of framework-agnostic components that are very common.

All contributions, issues, requests or feedback are warmly welcome.

Installation

Install pre-built binary on releases page:

  1. curl -LJO https://github.com/groovili/go-wagen/releases/download/v1.0.0/go-wagen-osx.tar.gz
  2. tar -f go-wagen-osx.tar.gz -x

or build from source code:

  1. git clone https://github.com/groovili/go-wagen && cd go-wagen
  2. make install - will install packr to wrap templates to binary
  3. make build

Binary doesn't need to be in $GOPATH and works without any dependencies.

Usage

  1. ./go-wagen --path=/absoule/path/to/project and select dependencies
  2. cd /absoule/path/to/project
  3. go mod vendor
  4. make run - will build and run container with code
  5. make test - to run container with tests
  6. make lint - to run linter for source code

Structure

Application generated with go-wagen will have following structure:

├── Makefile
├── cmd
│   └── example
│       └── example.go - app entrypoint
├── config - config presets for each env of default pipline
│   ├── app.dev.yml
│   ├── app.local.yml
│   └── app.yml
├── deploy
│   ├── Dockerfile
│   └── docker-compose.yml
├── go.mod
├── internal - for shared internal tools
├── server
│   ├── handlers
│   │   ├── hello.go
│   │   └── ping.go
│   └── middleware
│       └── log.go
├── storage - db/storages
└── vendor - downloaded modules