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
27 changes: 20 additions & 7 deletions CONTRIBUTING.md
Expand Up @@ -44,30 +44,43 @@ 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
2. Any significant changes should almost always be accompanied by tests. The
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please revert the changes to the numbering? I know it makes sense to have the correct number in the code, but with markdown it’s often just fine to designate that each of these is a list item, which can be done with 1. This article talks about it.

project already has good test coverage, so look at some of the existing
tests if you're unsure how to go about it. [gocov][] and [gocov-html][]
are invaluable tools for seeing which parts of your code aren't being
exercised by your tests.

1. Please run:
3. Please run:
* `go generate github.com/google/go-github/...`
* `go test github.com/google/go-github/...`
* `go vet github.com/google/go-github/...`

1. Do your best to have [well-formed commit messages][] for each change.
The `go generate ./...` command will update or generate certain files, and the resulting changes should be included in your pull request.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add line breaks (lines 61, 63, 65, 67, and 77 are all sort of long; adding line breaks may mean needing to adjust the text below each line, too) to match the rest of the file?
Could you also please delete the extra blank lines in between the lines of text that are all part of this block (i.e.: lines 62, 64, and 66)?


The `go test ./...` command will run tests inside your code. This will help you spot places where code might be faulty before commiting.
XaurDesu marked this conversation as resolved.
Show resolved Hide resolved

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 on further detail there.
XaurDesu marked this conversation as resolved.
Show resolved Hide resolved

4. 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][].
5. 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.

[Go Documentation]: https://pkg.go.dev/std
XaurDesu marked this conversation as resolved.
Show resolved Hide resolved
[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