You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* docs: based on #319, all files changed to lowercase without '_' except for '_test.go' files
* update go.mod version to go 1.17
* update golangci-lint version to v1.42.0
* update go-version to 1.17
* update contributing guidelines
* add list from directory.md into readme.md
* Delete DIRECTORY.md
Co-authored-by: Christian Clauss <[email protected]>
Co-authored-by: Andrii Siriak <[email protected]>
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+30-18Lines changed: 30 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,13 +15,13 @@ Welcome to [TheAlgorithms/Go](https://github.com/TheAlgorithms/Go)! Before submi
15
15
Being a contributor at The Algorithms, we request you to follow the points mentioned below:
16
16
17
17
- You did your own work.
18
-
- No plagiarism allowed. Any plagiarized work will not be merged.
18
+
- No plagiarism is allowed. Any plagiarized work will not be merged.
19
19
- Your work will be distributed under the [MIT License](https://github.com/TheAlgoritms/Go/blob/master/LICENSE) once your pull request has been merged.
20
20
- Please follow the repository guidelines and standards mentioned below.
21
21
22
22
**New implementation** New implementations are welcome!
23
23
24
-
You can add new algorithms or data structures which are **not present in the repository** or that can **improve** the old implementations (**documentation**, **improving test cases**, removing bugs or in any other resonable sense)
24
+
You can add new algorithms or data structures that are **not present in the repository** or that can **improve** the old implementations (**documentation**, **improving test cases**, removing bugs, or in any other reasonable sense)
25
25
26
26
**Issues** Please avoid opening issues asking to be "assigned” to a particular algorithm. This merely creates unnecessary noise for maintainers. Instead, please submit your implementation in a pull request, and it will be evaluated by project maintainers.
27
27
@@ -33,7 +33,7 @@ You can add new algorithms or data structures which are **not present in the rep
33
33
- Make sure the file extensions should be `*.go`.
34
34
- Use meaning variable names.
35
35
- Use standard library inside your code and avoid to import packages from other repositories
36
-
- If an implementation of the algorithm already exists, please refer to the [file-name section below](#new-file-name-guidelines).
36
+
- If an implementation of the algorithm already exists, please refer to the [filename section below](#new-file-name-guidelines).
37
37
- You can suggest reasonable changes to existing algorithms.
38
38
- Strictly use snake_case (underscore_separated) in filenames.
39
39
- If you have added or modified code, please make sure the code compiles before submitting.
@@ -55,6 +55,13 @@ You can add new algorithms or data structures which are **not present in the rep
55
55
- If you find an algorithm or document without tests, please feel free to create a pull request or issue describing suggested changes.
56
56
- Please try to add one or more `Test` functions that will invoke the algorithm implementation on random test data with the expected output.
57
57
58
+
### Benchmark
59
+
60
+
- Make sure to add examples and benchmark cases in your `filename_test.go` or `filename_bench.go` if you want separated test and benchmark files.
61
+
- If you find an algorithm or document without benchmarks, please feel free to create a pull request or issue describing suggested changes.
62
+
- Please try to add one or more `Benchmark` functions that will invoke the algorithm implementation.
63
+
- For running the benchmark, you could use this command `go test -bench=.` for more details, read this article [Using Subtests and Sub-benchmarks](https://go.dev/blog/subtests)
64
+
58
65
#### Typical structure of a program
59
66
60
67
```go
@@ -66,8 +73,9 @@ You can add new algorithms or data structures which are **not present in the rep
- Use lowercase words without ``"_"`` for the file name
106
+
- Use ``"_"`` as a separator only for `_test.go` or `_bench.go`
98
107
- For instance
99
108
100
109
```markdown
101
110
MyNewGoFile.GO is incorrect
102
-
my_new_go_file.go is correct format
111
+
my_new_go_file.go is incorrect
112
+
mynewgofile.go is the correct format
113
+
mynewgofile_test.go is the correct format
103
114
```
104
115
105
116
- It will be used to dynamically create a directory of files and implementation.
106
117
- File name validation will run on Docker to ensure validity.
107
-
- If an implementation of the algorithm already exists and your version is different from that implemented, please use incremental numeric digit as a suffix. For example: if `binary_search.go` already exists in the `search` folder, and you are contributing a new implementation, the filename should be `binary_search2.go` and for a third implementation, `binary_search3.go`.
118
+
- If an implementation of the algorithm already exists and your version is different from that implemented, please use incremental numeric digit as a suffix. For example: if `binarysearch.go` already exists in the `search` folder, and you are contributing a new implementation, the filename should be `binarysearch2.go` and for a third implementation, `binarysearch3.go`.
119
+
- Check out `Go`[Package names](https://go.dev/blog/package-names) roles
108
120
109
121
#### New Directory guidelines
110
122
@@ -125,17 +137,17 @@ some_new_fancy_category is correct
125
137
- It is recommended to keep your changes grouped logically within individual commits. Maintainers find it easier to understand changes that are logically spilled across multiple commits. Try to modify just one or two files in the same directory. Pull requests that span multiple directories are often rejected.
126
138
127
139
```bash
128
-
git add file_xyz.go
140
+
git add filexyz.go
129
141
git commit -m "your message"
130
142
```
131
143
132
144
Examples of commit messages with semantic prefixes:
133
145
134
146
```markdown
135
-
fix: xyz algorithm bug
136
-
feat: add xyx algorithm
137
-
test: add test for xyz algorithm
138
-
docs: add comments and explanation to xyz algorithm
147
+
fix: XYZ algorithm bug
148
+
feat: add XYZ algorithm
149
+
test: add test for XYZ algorithm
150
+
docs: add comments and explanation to XYZ algorithm
0 commit comments