/go-template

Primary LanguageGoMIT LicenseMIT

A Go Template

This is an example go application which includes a single application with two interfaces, HTTP and CLI.

Project layout structure was adapted from go-standards/project-layout

Features

  • Rest API
    • Swagger
  • CLI
    • Subcommands
  • Config
    • Dynamic build config
    • Env variables
  • Tests
  • Build
    • Dockerfile

Dependencies

  • gorilla/Mux - A powerful HTTP router and URL matcher for building Go web servers with 🦍
  • spf13/Cobra - A Commander for modern Go CLI interactions.
  • swaggo/Swag - Automatically generate RESTful API documentation with Swagger 2.0 for Go.
  • stretchr/testify - A toolkit with common assertions and mocks that plays nicely with the standard library.
  • tidwall/Buntdb - A low-level, in-memory, key/value store in pure Go. (only used to demonstrate functionality)

Additional optional dependencies

  • gorilla/* - Websockets, middleware, csrf, sessions, etc
  • spf13/viper - Viper is a complete configuration solution for Go applications including 12-Factor apps.

Use

To use this clone the repo and make changes as you need. All build and doc generation is handled through make.