If you're looking to contribute to this project, there's a few things you should know.
First, make sure you go through the README.
Second, it's written in Go. If you are new to Go, we recommend the following resources:
- Go 1.12+
- Make
- ...
You should already have installed Go.
Clone the repo.
$ git clone [email protected]:CircleCI-Public/circleci-cli.git
$ cd circleci-cli
If you cloned the repo inside of your $GOPATH
, you can use GO111MODULE=on
in order to use Go modules. We recommend cloning the repo outside of $GOPATH
as you would any other source code project, for example ~/code/circleci-cli
.
$ make
$ make test
If you ran go install
at some point, you will have a development version of circleci-cli
lingering around. You should clean this up with make clean
.
$ which circleci-cli
/Users/erichu/go/bin/circleci-cli
$ make clean
$ which circleci-cli
$
We use Go 1.11 Modules for managing our dependencies.
You can read more about it on the wiki: https://github.com/golang/go/wiki/Modules
We use gometalinter
for linting.
However, since we updated to Go 1.11 modules this doesn't work.
You will have to run our lint
job inside a local build in order to lint your code changes.
This requires docker and may fail if the docker is not available on your machine.
Once you have installed Docker, you can execute the lint
job locally with $ make lint
.
There is also a coverage
job as part of the build which will lint any code you commit.
This can be run manually with $ make cover
.
Go has great tooling such as gofmt
and goimports
.
In particular, please be sure to gofmt
your code before committing.
You can install goimport
via:
$ go get golang.org/x/tools/cmd/goimports
The golang blog post "go fmt your code" has a lot more info gofmt
. To get it setup with vim or emacs.
For example, I've the following in my .emacs.d/init.el
:
(setq gofmt-command "goimports")
(require 'go-mode)
(add-hook 'before-save-hook 'gofmt-before-save)
(require 'go-rename)
You can view the documentation for this project in your browser using godoc
.
After installing it via make dev
.
- Run
make doc
. - Access http://localhost:6060/pkg/github.com/CircleCI-Public/circleci-cli/