Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.87 KB

CONTRIBUTING.md

File metadata and controls

29 lines (22 loc) · 1.87 KB

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 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 guidelines.
When you’re ready to create a pull request, be sure to:

  • Have unit test for the new code.
  • Run goimport.
  • 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) in paho.mqtt.testing

Testing

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

Mocking

Gmqtt uses GoMock 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

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 for easy assertion.