goinit is a CLI that makes it easy to generate a new Go project.
A new project contains:
.git
go.mod
README.md
LICENSE
(default: MIT).gitignore
Run go get github.com/henrikac/goinit
to install goinit. (Note: Go v1.17+ use go install
instead)
After goinit has been installed it is recommended to set GO_INIT_PATH
. This will tell goinit where it should generate new projects.
An example could be export GO_INIT_PATH=$HOME/go/src/github.com/your-github-user
New projects will be generated in GO_INIT_PATH
if non-empty, otherwise in GOPATH
.
If both GO_INIT_PATH
and GOPATH
are empty a default path is used user-home-dir/go/src
(e.g. $HOME/go/src
on Unix).
Run:
goinit new <project name>
to create a new project (see note below).goinit new <project name> <module path>
to create a new project.goinit new <project name> <module path> -p path/to/new/project
to create a new project at the specified path.goinit new <project name> -l bsd2
to create a new project with a bsd2 license. Use-l ""
if you don't want a license in your project.
NOTE:
goinit new <project name>
will only work ifGO_INIT_PATH
is set to e.g.$GOPATH/src/github.com/your-github-user
. If not setup like this usegoinit new <project name> <module path>
instead.
To list all available licenses run goinit licenses list
.
Currently available licenses:
- Apache
- BSD2
- BSD3
- GPL2
- GPL3
- MIT (default)
To read a license run goinit licenses read <license name>
.
- Fork it (https://github.com/henrikac/goinit/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Henrik Christensen - creator and maintainer