Skip to content

Commit

Permalink
Add go generate mention to CONTRIBUTING.md (#2587)
Browse files Browse the repository at this point in the history
Fixes: #2579.
  • Loading branch information
XaurDesu committed Feb 13, 2023
1 parent e26cdd7 commit 175f3bf
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 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,18 +58,35 @@ 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
[go vet]: https://pkg.go.dev/cmd/vet
[gocov]: https://github.com/axw/gocov
[gocov-html]: https://github.com/matm/gocov-html
[well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
Expand Down Expand Up @@ -128,4 +144,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.

0 comments on commit 175f3bf

Please sign in to comment.