gmc
(Go mod create) is a CLI that creates Go modules
$ gmc -g github.com/jbrudvik/mymodule
Creating Go module: github.com/jbrudvik/mymodule
- Created directory: mymodule
- Initialized Go module
- Created file : mymodule/main.go
- Created file : mymodule/.gitignore
- Initialized Git repository
- Created file : mymodule/README.md
- Committed all files to Git repository
- Added remote for Git repository: git@github.com:jbrudvik/mymodule.git
Finished creating Go module: github.com/jbrudvik/mymodule
Next steps:
- Change into module's directory: $ cd mymodule
- Run module: $ go run .
- Create remote Git repository git@github.com:jbrudvik/mymodule.git: https://github.com/new
- Push to remote Git repository: $ git push -u origin main
- Start coding: $ vim .
$ gmc -h
NAME:
gmc - (Go mod create) creates Go modules
USAGE:
gmc [global options] [module name]
VERSION:
vX.Y.Z
DESCRIPTION:
`gmc [module name]` creates a directory containing:
- Go module metadata: go.mod
- A place to start writing code: main.go
- A .gitignore file
This module can be immediately run:
$ go run .
hello, world!
Optionally, the directory can also include:
- Git repository setup with .gitignore, README.md
More information: https://github.com/jbrudvik/gmc
GLOBAL OPTIONS:
--git, -g create as Git repository (default: false)
--quiet, -q silence output (default: false)
--help, -h show help (default: false)
--version, -v print the version (default: false)
- Go 1.18
- goimports:
$ go install golang.org/x/tools/cmd/goimports@latest
- Git (for Git-related features)
$ go install github.com/jbrudvik/gmc@latest