Please, before sending patches, read these brief comments. They are here to help the project have both its users happy using the program and the developers/maintainers feel good when trying to change code that other people contributed.
When you write your pull request and your commit messages, please, be detailed, explaining why you are doing what you are doing. Don't be afraid of being too verbose here. Also, please follow the highly recommended guidelines on how to write good good commit messages.
When in doubt, follow the model of the Linux kernel commit logs. Their commit messages are some of the best that I have seen. Also, the ffmpeg has some good messages that I believe that should be followed. If you are in a hurry, read the section named "Contributing" from subsurface's README.
Run the test suite with
go test
If some test fails, please don't send your changes yet. Fix what broke before sending your pull request.
If you need to change the test suite, explain in the commit message why it needs to be changed.
The Prometheus project uses Go modules to manage dependencies on external packages.
To add or update a new dependency, use the go get
command:
# Pick the latest tagged release.
go get example.com/some/module/pkg@latest
# Pick a specific version.
go get example.com/some/module/[email protected]
Tidy up the go.mod
and go.sum
files:
# The GO111MODULE variable can be omitted when the code isn't located in GOPATH.
GO111MODULE=on go mod tidy
You have to commit the changes to go.mod
and go.sum
before submitting the pull request.
Please, help keep the code tidy by checking for any potential bugs with the help of golangci-lint. Fixing the code to comply with the linter's recommendation is in general the preferred course of action.
If you happen to find any issue reported by these programs, I welcome you to fix them. Many of the issues are usually very easy to fix and they are a great way to start contributing to this (and other projects in general). Furthermore, we all benefit from a better code base.