Skip to content

Commit

Permalink
docs: Add contributing guide
Browse files Browse the repository at this point in the history
  • Loading branch information
DrmagicE committed Dec 27, 2020
1 parent 33e0b70 commit 2550052
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Contributing to Gmqtt
We welcome contributions to Gmqtt of any kind including documentation, plugin, test, bug reports, issues, feature requests, typo fix, etc.

If you want to write some code, but don't know where to start or what you might want to do, take a look at the [Unplanned](https://github.com/DrmagicE/gmqtt/milestone/2) milestone.

## Contributing Code
Feel free submit a pull request. Any pull request must be related to one or more open issues.
If you are submitting a complex feature, it is recommended to open up a discussion or design proposal on issue track to get feedback before you start.

### Code Style
Gmqtt is a Go project, it is recommended to follow the [CodeReviewComments](https://github.com/golang/go/wiki/CodeReviewComments) guidelines.
When you’re ready to create a pull request, be sure to:
* Have unit test for the new code.
* Run [goimport](https://godoc.org/golang.org/x/tools/cmd/goimports).
* Run go test -race ./...
* Build the project with race detection enable (go build -race .), and pass both V3 and V5 test cases (except test_flow_control2 [#68](https://github.com/eclipse/paho.mqtt.testing/issues/68)) in [paho.mqtt.testing](https://github.com/eclipse/paho.mqtt.testing/tree/master/interoperability)


### Testing
Testing is really important for building a robust application. Any new code or changes must come with unit test.

#### Mocking
Gmqtt uses [GoMock](https://github.com/golang/mock) to generate mock codes. The mock file must begin with the source file name and ends with `_mock.go`. For example, the following command will generate the mock file for `client.go`
```bash
mockgen -source=server/client.go -destination=/usr/local/gopath/src/github.com/DrmagicE/gmqtt/server/client_mock.go -package=server -self_package=github.com/DrmagicE/gmqtt/server
```
#### Assertion
Please use [testify](https://github.com/stretchr/testify) for easy assertion.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ See `/examples/hook` for details.
## How to write plugins
[How to write plugins](https://github.com/DrmagicE/gmqtt/blob/master/plugin/README.md)

# Contributing
Contributions are always welcome, see [Contribution Guide](https://github.com/DrmagicE/gmqtt/blob/master/CONTRIBUTING.md) for a complete contributing guide.

# Test
## Unit Test
```
Expand Down

0 comments on commit 2550052

Please sign in to comment.