This project acts as a template for new Go projects I develop. Most of my projects follow a certain structure:
- there is a
Makefile
with common targets so everyone can easily build and test the project- the applications version and build time is set at compile time through
ldflags
- there is a
check
target to lint the code and ensure that it is properly formatted - it uses vgo and the new module system
- the applications version and build time is set at compile time through
$ git clone https://github.com/klingtnet/go-project-template.git
$ cd go-project-template
$ make
$ ./example
INFO[0000] [email protected] build time: 2017-07-03T12:31:38+00:00
How to use this as a start for a new project:
$ git clone --depth=1 https://github.com/klingtnet/go-project-template.git my-new-project
and adjust the module path in the go.mod
file.
- build the project:
make
- test the project:
make test
- clean build artifacts and vendor folder:
make clean