This repository provides a clean and organized starter structure for building scalable Go applications.
With examples for API and a simple binary, you can take them and expand as you need and adding internal app logic into internal folder (because of this is empty, depends on you mate)
- docker
- go (>=1.26)
- make
- Organized into
cmddirectory, as entrypoint and example for a basic hello world or api. - Makefile with basic go commands to compile.
- Clean and minimal baseline for Go development.
cmd/main # Entry point as a basic program
cmd/api # Entry point as a basic api
Makefile # Common development commands
- Clone this repo run:
git clone {url/ssh repo}
cd go-basic-env
- Initialize the module in case you don't want to have same module name. Remove
go.modandgo.sumand run:
go mod init {your-project-name/url-here}
go mod tidy
-
Do your code. Check examples on
cmd/mainorcmd/apifor the entrypoints and extend it to internal. -
Run the
cmd/mainlocally:
make run-main
- To compile the binaries from the cmd:
make build
- To run unit tests:
make test
- To run api server:
make docker-run
- logs in grafana api -> alloy -> loki -> grafana (docker compose + makefile commands)
- traces in grafana api (docker compose updates)
- cmd/command as an example for cli code.
Distributed under the MIT License. See LICENSE for more information.