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.
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.
You can create a new Gone project using:
gonectr create my-gone-project
This initializes a new Gone project directory named my-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
This command generates Priest function code, a feature adapted from gone tools.
To learn more, run:
gonectr priest -h
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
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
The run
command generates helper code (if needed) before running the project with go run
.
To learn more, run:
gonectr run -h