ProductPromotion
Logo

Go.Lang

made by https://0x3d.site

GitHub - lacion/cookiecutter-golang: A Go project template
A Go project template. Contribute to lacion/cookiecutter-golang development by creating an account on GitHub.
Visit Site

GitHub - lacion/cookiecutter-golang: A Go project template

GitHub - lacion/cookiecutter-golang: A Go project template

cookiecutter-golang

Build Status

Powered by Cookiecutter, Cookiecutter Golang is a framework for jumpstarting production-ready go projects quickly.

Features

  • Generous Makefile with management commands
  • Uses go dep (with optional go module support requires go 1.11)
  • injects build time and git hash at build time.

Optional Integrations

  • Can use viper for env var config
  • Can use cobra for cli tools
  • Can use logrus for logging
  • Can create dockerfile for building go binary and dockerfile for final go binary (no code in final container)
  • If docker is used adds docker management commands to makefile
  • Option of TravisCI, CircleCI or None

Constraints

  • Uses dep or mod for dependency management
  • Only maintained 3rd party libraries are used.

This project now uses docker multistage builds, you need at least docker version v17.05.0-ce to use the docker file in this template, you can read more about multistage builds here.

Docker

This template uses docker multistage builds to make images slimmer and containers only the final project binary and assets with no source code whatsoever.

You can find the image dokcer file in this repo and more information about docker multistage builds in this blog post.

Apps run under non root user and also with dumb-init.

Usage

Let's pretend you want to create a project called "echoserver". Rather than starting from scratch maybe copying some files and then editing the results to include your name, email, and various configuration issues that always get forgotten until the worst possible moment, get cookiecutter to do all the work.

First, get Cookiecutter. Trust me, it's awesome:

$ pip install cookiecutter

Alternatively, you can install cookiecutter with homebrew:

$ brew install cookiecutter

Finally, to run it based on this template, type:

$ cookiecutter https://github.com/lacion/cookiecutter-golang.git

You will be asked about your basic info (name, project name, app name, etc.). This info will be used to customize your new project.

Warning: After this point, change 'Luis Morales', 'lacion', etc to your own information.

Answer the prompts with your own desired options. For example:

full_name [Luis Morales]: Luis Morales
github_username [lacion]: lacion
app_name [mygolangproject]: echoserver
project_short_description [A Golang project.]: Awesome Echo Server
docker_hub_username [lacion]: lacion
docker_image [lacion/docker-alpine:latest]: lacion/docker-alpine:latest
docker_build_image [lacion/docker-alpine:gobuildimage]: lacion/docker-alpine:gobuildimage
use_docker [y]: y
use_git [y]: y
use_logrus_logging [y]: y
use_viper_config [y]: y
use_cobra_cmd [y]: y
Select use_ci:
1 - travis
2 - circle
3 - none
Choose from 1, 2, 3 [1]: 1

Enter the project and take a look around:

$ cd echoserver/
$ ls

Run make help to see the available management commands, or just run make build to build your project.

$ make help
$ make build
$ ./bin/echoserver

Projects build with cookiecutter-golang

  • iothub websocket multiroom server for IoT

Articles
to learn more about the golang concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Queries
or most google FAQ's about GoLang.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory