mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-01 15:10:44 +00:00
CodeLingo setup (#224)
This commit is contained in:
committed by
Adrian Gallagher
parent
2398cb2568
commit
9ebcb1a462
46
.github/CONTRIBUTING_TEMPLATE.md
vendored
Normal file
46
.github/CONTRIBUTING_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<!-- use this template to generate the contributor docs with the following command: `$ lingo run docs --template CONTRIBUTING_TEMPLATE.md --output CONTRIBUTING.md` -->
|
||||
# Contributing
|
||||
|
||||
## Please contribute
|
||||
|
||||
All PR's are welcome
|
||||
|
||||
## Coding Style
|
||||
|
||||
In order to maintain a consistent style across the codebase, the following coding style has been adopted:
|
||||
|
||||
- Function names use PascalCase (func SomeFunc()).
|
||||
- Function names using acronyms are capitilised (func SendHTTPRequest()).
|
||||
- Variable names use CamelCase (var someVar()).
|
||||
- Coding style uses gofmt.
|
||||
- Const variables are CamelCase depending on exported items.
|
||||
- In line with gofmt, for loops and if statements don't require parenthesis.
|
||||
|
||||
Block style example:
|
||||
```go
|
||||
func SendHTTPRequest(method, path string, headers map[string]string, body io.Reader) (string, error) {
|
||||
result := strings.ToUpper(method)
|
||||
|
||||
if result != "POST" && result != "GET" && result != "DELETE" {
|
||||
return "", errors.New("Invalid HTTP method specified.")
|
||||
}
|
||||
|
||||
req, err := http.NewRequest(method, path, body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for k, v := range headers {
|
||||
req.Header.Add(k, v)
|
||||
}
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
## Effective Go Guidelines
|
||||
[CodeLingo](https://codelingo.io) automatically checks every pull request against the following guidelines from [Effective Go](https://golang.org/doc/effective_go.html).
|
||||
|
||||
{{range .}}
|
||||
### {{.title}}
|
||||
{{.body}}
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user