|
| 1 | +# Contributing to go-common |
| 2 | + |
| 3 | +Thank you for considering contributing to **go-common**! Every contribution is welcome, whether it's a bug report, a feature request, or a pull request. |
| 4 | + |
| 5 | +## How to Report a Bug |
| 6 | + |
| 7 | +1. Check the [existing issues](https://github.com/pmoscode/go-common/issues) to see if the bug has already been reported. |
| 8 | +2. If not, open a new issue with: |
| 9 | + - A clear and descriptive title |
| 10 | + - Steps to reproduce the problem |
| 11 | + - Expected vs. actual behavior |
| 12 | + - Go version and OS |
| 13 | + |
| 14 | +## How to Suggest a Feature |
| 15 | + |
| 16 | +Open an issue with the **feature request** label. Describe the use case and why the feature would be useful. |
| 17 | + |
| 18 | +## How to Submit a Pull Request |
| 19 | + |
| 20 | +1. **Fork** the repository and create a new branch from `main`. |
| 21 | +2. **Install dependencies:** |
| 22 | + ```bash |
| 23 | + go mod tidy |
| 24 | + ``` |
| 25 | +3. **Make your changes.** Follow the conventions below. |
| 26 | +4. **Run the tests:** |
| 27 | + ```bash |
| 28 | + go test ./... |
| 29 | + ``` |
| 30 | +5. **Run static analysis** (if [staticcheck](https://staticcheck.dev/docs/getting-started/) is installed): |
| 31 | + ```bash |
| 32 | + staticcheck ./... |
| 33 | + ``` |
| 34 | +6. **Commit** with a clear message describing what you changed and why. |
| 35 | +7. **Open a Pull Request** against `main`. |
| 36 | + |
| 37 | +## Code Conventions |
| 38 | + |
| 39 | +- **File naming:** Name the primary file in a package after the package itself (e.g. `filter/filter.go`), not `main.go`. |
| 40 | +- **Error handling:** Return errors to the caller. Do not use `panic`, `log.Fatal`, or `fmt.Println` for error handling in library code. |
| 41 | +- **Logging:** Use the `log` standard library for warnings. Do not use `fmt.Print*` for log output. |
| 42 | +- **GoDoc:** All exported types, functions, and methods must have GoDoc comments. |
| 43 | +- **Deprecation:** Use the standard Go `// Deprecated: ...` comment format. |
| 44 | +- **Testing:** Use [testify](https://github.com/stretchr/testify) (`assert` / `require`) for assertions. Use `require` for setup errors and `assert` for value checks. |
| 45 | + |
| 46 | +## Security |
| 47 | + |
| 48 | +If you discover a security vulnerability, please **do not** open a public issue. Instead, refer to the [Security Policy](SECURITY.md) for instructions on responsible disclosure. |
| 49 | + |
| 50 | +## License |
| 51 | + |
| 52 | +By contributing, you agree that your contributions will be licensed under the same license as the project (see [LICENSE](LICENSE)). |
| 53 | + |
0 commit comments