-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
docs: Add Contributing Guidelines #463
Merged
vvatanabe
merged 1 commit into
sashabaranov:master
from
vvatanabe:contributing-guidelines
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Contributing Guidelines | ||
|
||
## Overview | ||
Thank you for your interest in contributing to the "Go OpenAI" project! By following this guideline, we hope to ensure that your contributions are made smoothly and efficiently. The Go OpenAI project is licensed under the [Apache 2.0 License](https://github.com/sashabaranov/go-openai/blob/master/LICENSE), and we welcome contributions through GitHub pull requests. | ||
|
||
## Reporting Bugs | ||
If you discover a bug, first check the [GitHub Issues page](https://github.com/sashabaranov/go-openai/issues) to see if the issue has already been reported. If you're reporting a new issue, please use the "Bug report" template and provide detailed information about the problem, including steps to reproduce it. | ||
|
||
## Suggesting Features | ||
If you want to suggest a new feature or improvement, first check the [GitHub Issues page](https://github.com/sashabaranov/go-openai/issues) to ensure a similar suggestion hasn't already been made. Use the "Feature request" template to provide a detailed description of your suggestion. | ||
|
||
## Reporting Vulnerabilities | ||
If you identify a security concern, please use the "Report a security vulnerability" template on the [GitHub Issues page](https://github.com/sashabaranov/go-openai/issues) to share the details. This report will only be viewable to repository maintainers. You will be credited if the advisory is published. | ||
|
||
## Questions for Users | ||
If you have questions, please utilize [StackOverflow](https://stackoverflow.com/) or the [GitHub Discussions page](https://github.com/sashabaranov/go-openai/discussions). | ||
|
||
## Contributing Code | ||
There might already be a similar pull requests submitted! Please search for [pull requests](https://github.com/sashabaranov/go-openai/pulls) before creating one. | ||
|
||
### Requirements for Merging a Pull Request | ||
|
||
The requirements to accept a pull request are as follows: | ||
|
||
- Features not provided by the OpenAI API will not be accepted. | ||
- The functionality of the feature must match that of the official OpenAI API. | ||
- All pull requests should be written in Go according to common conventions, formatted with `goimports`, and free of warnings from tools like `golangci-lint`. | ||
- Include tests and ensure all tests pass. | ||
- Maintain test coverage without any reduction. | ||
- All pull requests require approval from at least one Go OpenAI maintainer. | ||
|
||
**Note:** | ||
The merging method for pull requests in this repository is squash merge. | ||
|
||
### Creating a Pull Request | ||
- Fork the repository. | ||
- Create a new branch and commit your changes. | ||
- Push that branch to GitHub. | ||
- Start a new Pull Request on GitHub. (Please use the pull request template to provide detailed information.) | ||
|
||
**Note:** | ||
If your changes introduce breaking changes, please prefix your pull request title with "[BREAKING_CHANGES]". | ||
|
||
### Code Style | ||
In this project, we adhere to the standard coding style of Go. Your code should maintain consistency with the rest of the codebase. To achieve this, please format your code using tools like `goimports` and resolve any syntax or style issues with `golangci-lint`. | ||
|
||
**Run goimports:** | ||
``` | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
``` | ||
|
||
``` | ||
goimports -w . | ||
``` | ||
|
||
**Run golangci-lint:** | ||
``` | ||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
``` | ||
|
||
``` | ||
golangci-lint run --out-format=github-actions | ||
``` | ||
|
||
### Unit Test | ||
Please create or update tests relevant to your changes. Ensure all tests run successfully to verify that your modifications do not adversely affect other functionalities. | ||
|
||
**Run test:** | ||
``` | ||
go test -v ./... | ||
``` | ||
|
||
### Integration Test | ||
Integration tests are requested against the production version of the OpenAI API. These tests will verify that the library is properly coded against the actual behavior of the API, and will fail upon any incompatible change in the API. | ||
|
||
**Notes:** | ||
These tests send real network traffic to the OpenAI API and may reach rate limits. Temporary network problems may also cause the test to fail. | ||
|
||
**Run integration test:** | ||
``` | ||
OPENAI_TOKEN=XXX go test -v -tags=integration ./api_integration_test.go | ||
``` | ||
|
||
If the `OPENAI_TOKEN` environment variable is not available, integration tests will be skipped. | ||
|
||
--- | ||
|
||
We wholeheartedly welcome your active participation. Let's build an amazing project together! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a really great PR, thank you so much @vvatanabe! Sorry for such a long delay with the review.
Just a note: it seems that golangci-lint does include goimports into itself, so it's enough to run to just run the golangci-lint.
To reproduce:
Produces:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sashabaranov Thanks for the feedback. Indeed,
golangci-lint
does give warnings, but to fix them, you need to run goimports yourself. I've added instructions on how to rungoimports
to help developers who are not familiar with Go handle it smoothly.Don't worry about the delayed response. You should focus on what you need to prioritize! It's more important.