[skip ci] change CONTRIBUTING.mad to add go code style (#7817)

Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
pull/7844/head
Xiaofan 2021-09-13 20:58:57 +08:00 committed by GitHub
parent 2e575cb9c1
commit 64918f80b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 3 deletions

View File

@ -70,7 +70,14 @@ $ git commit -s -m 'This is my commit message'
```
## Coding Style
The coding style used in Milvus generally follow [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
Keeping a consistent style for code, code comments, commit messages, and PR descriptions will greatly accelerate your PR review process. We highly recommend you refer to and comply to the following style guides when you put together your pull requests:
###GO
- Coding style: refer to the [Effictive Go Style Guide](https://golang.org/doc/effective_go)
###C++
The c++ coding style used in Milvus generally follow [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
And we made the following changes based on the guide:
- 4 spaces for indentation
@ -78,8 +85,16 @@ And we made the following changes based on the guide:
- 120-character line length
- Camel-Cased file names
### Format code
### Commits and PRs
- Commit message and PR description style: refer to [good commit messages](https://chris.beams.io/posts/git-commit)
### Format code
####GO
```shell
$ make fmt
```
####C++
Install clang-format
```shell
$ sudo apt-get install clang-format
@ -96,9 +111,14 @@ $ make clang-format
```
## Run unit test with code coverage
Before submitting your Pull Request, make sure you have run unit test, and your code coverage rate is >= 90%.
###GO
```shell
$ go test -coverprofile fmtcoverage.html ./internal/allocator
ok github.com/milvus-io/milvus/internal/allocator 0.048s coverage: 69.6% of statements
```
###C++
Install lcov
```shell
$ sudo apt-get install lcov