Awesome
gonectr
gonectr
is a command-line tool tailored for creating and managing Gone projects. It provides functionality for generating code, compiling, and running Gone projects efficiently.
Installation
To install gonectr
, run the following command:
go install github.com/gone-io/gonectr@latest
This will install gonectr
into your $GOPATH/bin
directory. Make sure $GOPATH/bin
is included in your $PATH
to use gonectr
globally.
Usage
1. Create a New Gone Project
You can create a new Gone project using:
gonectr create my-gone-project
This initializes a new Gone project directory named my-gone-project
.
2. Generate Helper Code for Gone Project
Helper code files generated by gonectr
typically end with .gone.go
. It’s recommended to add *.gone.go
to your .gitignore
file to avoid versioning these generated files.
To generate helper code and learn more about its usage, run:
gonectr generate -h
3. Generate Priest Function Code
This command generates Priest function code, a feature adapted from gone tools.
To learn more, run:
gonectr priest -h
4. Generate Mock Code for Interfaces
This command generates mock code for interfaces, which is useful for testing. It requires the mockgen
tool. To install mockgen
, run:
go install go.uber.org/mock/mockgen@latest
To learn more, run:
gonectr mock -h
5. Build a Gone Project
The build
command first runs gonectr generate ...
to create any necessary helper code, then builds the project using go build
.
To learn more, run:
gonectr build -h
6. Run a Gone Project
The run
command generates helper code (if needed) before running the project with go run
.
To learn more, run:
gonectr run -h