This project is inspired by the likes of t3 create-react-app, ng generate, etc but with a focus on go.
- Blank: An empty go project
- CLI: Blank CLI template
- Completion: Inbuilt completions for your terminal
- Help: Is the inbuilt cobra help command
- Models: This creates a models folder/file to store model information
- Python: A blank python app.py
- Rest: A rest microservice template using http/net
- Service: Service templates
-g --git
: Initialize a git repo
I honestly just wanted to explore cobra more thoroughly, and this can be useful for me in the future as I create random Go projects. I know it's not hard to create new projects in go, but maybe this can evolve over time as become more familiar with cobra. I've found the best way to learn something is to put it in action.
Generic empty go project.
forge blank [name]
# blank aliases: b, --b, new
# name is optional, if not provided user is prompted for one
Cobra focused CLI project
forge cli [name]
# cli aliases: c --c
# name is optional, if not provided user in prompted for one
just another way to init a git repo
forge blank [name] -g
# alias b
The inbuilt help command
forge help
Create a models folder and file
forge models
# alias m
Create a rest API with net/http (assuming go 1.22) with middleware, helpers, models, etc.
forge rest [name]
# alias r
Create a python file
forge python [name]
#alias p
Create a new service structure for apis
forge service [name]
# alias s
Ideally I would love to add gRPC as a template option, but that seems a bit trickier to do at this time and will play around with it.
There is also an included Taskfile with the ability to build for different OSes.
- build-mac
- bin-mac: adds to /usr/local/bin
- build-linux
- bin-linux: adds to /usr/local/bin
- build-windows
- bin-windows: adds to C:\Windows\System32\
- zsh-ac: creates zsh auto complete instructions
- pwsh-ac: creates pwsh auto complete instructions
If you have any feedback or ways to improve this this I am happy to connect and discuss.