Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add go generate mention to CONTRIBUTING.md #2587

Merged
merged 12 commits into from Feb 13, 2023
26 changes: 22 additions & 4 deletions CONTRIBUTING.md
Expand Up @@ -44,9 +44,8 @@ are more sensitive, emailed to <opensource@google.com>.

1. Go makes it very simple to ensure properly formatted code, so always run
`go fmt` on your code before committing it. You should also run
[golint][] over your code. As noted in the [golint readme][], it's not
strictly necessary that your code be completely "lint-free", but this will
help you find common style issues.
[go vet][] over your code. this will help you find common style issues
within your code and will keep styling consistent within the project.

1. Any significant changes should almost always be accompanied by tests. The
project already has good test coverage, so look at some of the existing
Expand All @@ -59,15 +58,33 @@ are more sensitive, emailed to <opensource@google.com>.
* `go test github.com/google/go-github/...`
* `go vet github.com/google/go-github/...`

The `go generate ./...` command will update or generate certain files, and the
resulting changes should be included in your pull request.

The `go test ./...` command will run tests inside your code. This will help you
spot places where code might be faulty before committing.

And finally, the `go vet ./...` command will check linting and styling over your
code, keeping the project consistent formatting-wise.

In any case, it is always a good idea to read [official Go documentation][] when working
on this project, as the definition of tools and commands of the Go programming
language is described in further detail there.

1. Do your best to have [well-formed commit messages][] for each change.
This provides consistency throughout the project, and ensures that commit
messages are able to be formatted properly by various git tools.

1. Finally, push the commits to your fork and submit a [pull request][].
Before pushing commits, it is highly advised to check for generated files
that were either created or modified for the sake of your commit. Running
`go generate -x ./...` should return a log of modified generated files that should
be included alongside the manually written code in the commit.
**NOTE:** Please do not use force-push on PRs in this repo, as it makes
it more difficult for reviewers to see what has changed since the last
code review.

[official Go documentation]: https://pkg.go.dev/std
[forking]: https://help.github.com/articles/fork-a-repo
[golint]: https://github.com/golang/lint
[golint readme]: https://github.com/golang/lint/blob/master/README.md
XaurDesu marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -128,4 +145,5 @@ this][modified-comment].
[rebase-comment]: https://github.com/google/go-github/pull/277#issuecomment-183035491
[modified-comment]: https://github.com/google/go-github/pull/280#issuecomment-184859046

**When creating a release, don't forget to update the `Version` constant in `github.go`.** This is used to send the version in the `User-Agent` header to identify clients to the GitHub API.
**When creating a release, don't forget to update the `Version` constant in `github.go`.** This is used to
send the version in the `User-Agent` header to identify clients to the GitHub API.