Skip to content

Commit 8f80a3a

Browse files
committed
Go: reformat sentence spacing
1 parent 11e5587 commit 8f80a3a

File tree

6 files changed

+84
-84
lines changed

6 files changed

+84
-84
lines changed

Go/Git.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# AdGuard Go Team Git Guidelines
1+
# AdGuard Go Team Git guidelines
22

33
* <a href="#li-b085c724" id="li-b085c724" name="li-b085c724">§</a>
44
Call your branches either `NNNN-fix-foo` (where `NNNN` is the ID of the
55
GitHub / GitLab / Jira issue you worked on in this branch) or just `fix-foo`
6-
if there was no issue. Make sure to always spell the Jira IDs (but [not the
6+
if there was no issue. Make sure to always spell the Jira IDs (but [not the
77
suffix][low]) in uppercase letters to make sure it gets linked.
88

99
* <a href="#li-6ff49977" id="li-6ff49977" name="li-6ff49977">§</a>
1010
Do not put your text editors' temporary files into the project's
11-
`.gitignore` files. The more are added, the harder they become to maintain.
11+
`.gitignore` files. The more are added, the harder they become to maintain.
1212
Put them into your [global `.gitignore`][ignore] file instead.
1313

1414
Only build, run, and test outputs should be placed into `.gitignore`,
@@ -22,14 +22,14 @@
2222
```
2323
2424
Where `pkg` is usually the directory or Go package (without the
25-
`internal/…` part) where most changes took place. If there are several
26-
such packages, or the change is top-level only, write `all`.
25+
`internal/…` part) where most changes took place. If there are several such
26+
packages, or the change is top-level only, write `all`.
2727
2828
* <a href="#li-ebd6a188" id="li-ebd6a188" name="li-ebd6a188">§</a>
2929
Keep your commit messages, including headers, to eighty (**80**) columns.
3030
3131
* <a href="#li-b5f7773a" id="li-b5f7773a" name="li-b5f7773a">§</a>
32-
Only use lowercase letters in your commit message headers. The rest of the
32+
Only use lowercase letters in your commit message headers. The rest of the
3333
message should follow the [plain text conventions][text].
3434
3535
The exceptions are direct mentions of identifiers from the source code and

Go/Go.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AdGuard Go Team Development Guidelines
22

3-
Following this document is obligatory for all new Go code. Some of the rules
3+
Following this document is obligatory for all new Go code. Some of the rules
44
aren't enforced as thoroughly or remain broken in old code, but this is still
55
the place to find out about what we **want** our code to look like and how to
66
improve it.
@@ -31,16 +31,16 @@ The rules are mostly sorted in the alphabetical order.
3131
## <a href="#code" id="code" name="code">Code</a>
3232

3333
* <a href="#li-cb105c8c" id="li-cb105c8c" name="li-cb105c8c">§</a>
34-
Avoid `break` and `continue` with labels. Most of the time the code can be
34+
Avoid `break` and `continue` with labels. Most of the time the code can be
3535
rewritten without them, and most of the time the resulting new code is also
3636
clearer.
3737

3838
* <a href="#li-5305b436" id="li-5305b436" name="li-5305b436">§</a>
39-
Always `recover` from panics in new goroutines. Preferably in the very
40-
first statement. If all you want there is a log message, use `log.OnPanic`.
39+
Always `recover` from panics in new goroutines. Preferably in the very
40+
first statement. If all you want there is a log message, use `log.OnPanic`.
4141

4242
* <a href="#li-02028202" id="li-02028202" name="li-02028202">§</a>
43-
Avoid `fallthrough`. It makes it harder to rearrange `case`s, to reason
43+
Avoid `fallthrough`. It makes it harder to rearrange `case`s, to reason
4444
about the code, and also to switch the code to a handler approach, if that
4545
becomes necessary later.
4646

@@ -51,15 +51,15 @@ The rules are mostly sorted in the alphabetical order.
5151
Avoid `init` and use explicit initialization functions instead.
5252

5353
* <a href="#li-fa33e482" id="li-fa33e482" name="li-fa33e482">§</a>
54-
Avoid lazy initialization. Constructors should validate their arguments and
54+
Avoid lazy initialization. Constructors should validate their arguments and
5555
return meaningful errors.
5656

5757
* <a href="#li-6ae6bc94" id="li-6ae6bc94" name="li-6ae6bc94">§</a>
5858
Avoid `new`, especially with structs, unless a temporary value is needed,
5959
for example when checking the type of an error using `errors.As`.
6060

6161
* <a href="#li-c9d7fde7" id="li-c9d7fde7" name="li-c9d7fde7">§</a>
62-
Avoid packages `reflect` and `unsafe` unless absolutely necessary. Always
62+
Avoid packages `reflect` and `unsafe` unless absolutely necessary. Always
6363
provide a comment explaining why you are using it.
6464

6565
* <a href="#li-9d94cb85" id="li-9d94cb85" name="li-9d94cb85">§</a>
@@ -69,7 +69,7 @@ The rules are mostly sorted in the alphabetical order.
6969
For example, if you have a long function that makes an HTTP request and
7070
defers the close of the body at the beginning and then does more stuff, it's
7171
better to factor out the HTTP request and the response parsing into
72-
a separate method. Same goes for mutexes.
72+
a separate method. Same goes for mutexes.
7373

7474
That is, do **not** do this:
7575

@@ -83,7 +83,7 @@ The rules are mostly sorted in the alphabetical order.
8383
v, err := decode(r)
8484
check(err)
8585

86-
// Lots of slow stuff with v. r is only closed once Foo exits.
86+
// Lots of slow stuff with v. r is only closed once Foo exits.
8787
}
8888
```
8989

@@ -109,11 +109,11 @@ The rules are mostly sorted in the alphabetical order.
109109

110110
* <a href="#li-d027c6cd" id="li-d027c6cd" name="li-d027c6cd">§</a>
111111
Be aware of structure alignment as well as the number of [pointer
112-
bytes][ptr]. Exceptions could be made if a suboptimal alignment produces
112+
bytes][ptr]. Exceptions could be made if a suboptimal alignment produces
113113
significantly better readability.
114114

115115
```go
116-
// Bad! Lots of padding between the uint64s and bools. Pointers are at the
116+
// Bad! Lots of padding between the uint64s and bools. Pointers are at the
117117
// end of the structure.
118118
type bad struct {
119119
a uint64
@@ -129,7 +129,7 @@ The rules are mostly sorted in the alphabetical order.
129129
z *otherType
130130
}
131131
132-
// Good. The padding is minimized, and the pointers are closer to the top.
132+
// Good. The padding is minimized, and the pointers are closer to the top.
133133
type good struct {
134134
y *otherType
135135
z *otherType
@@ -166,9 +166,9 @@ The rules are mostly sorted in the alphabetical order.
166166
```
167167

168168
* <a href="#li-eaba198b" id="li-eaba198b" name="li-eaba198b">§</a>
169-
Context values should be considered immutable. Do not use modifications
170-
of context values as a means of communicating something up the stack. That
171-
is, do **not** do this:
169+
Context values should be considered immutable. Do not use modifications of
170+
context values as a means of communicating something up the stack. That is,
171+
do **not** do this:
172172

173173
```go
174174
// Bad! Function outer expects inner to mutate logEntry.
@@ -194,12 +194,12 @@ The rules are mostly sorted in the alphabetical order.
194194
```
195195

196196
* <a href="#li-450c3236" id="li-450c3236" name="li-450c3236">§</a>
197-
Don't rely only on file names for build tags to work. Always add build tags
197+
Don't rely only on file names for build tags to work. Always add build tags
198198
as well.
199199
200200
* <a href="#li-7a36cc4c" id="li-7a36cc4c" name="li-7a36cc4c">§</a>
201201
Don't use `fmt.Sprintf` where a more structured approach to string
202-
conversion could be used. For example, `netutil.JoinHostPort`,
202+
conversion could be used. For example, `netutil.JoinHostPort`,
203203
`net.JoinHostPort` or `url.(*URL).String`.
204204

205205
* <a href="#li-71081433" id="li-71081433" name="li-71081433">§</a>
@@ -216,24 +216,24 @@ The rules are mostly sorted in the alphabetical order.
216216

217217
* <a href="#li-b97aacf8" id="li-b97aacf8" name="li-b97aacf8">§</a>
218218
No name shadowing, including of predeclared identifiers, since it can often
219-
lead to subtle bugs, especially with errors. This rule does not apply to
219+
lead to subtle bugs, especially with errors. This rule does not apply to
220220
struct fields, since they are always used together with the name of the
221221
struct value, so there isn't any confusion.
222222
223223
* <a href="#li-74517cf1 " id="li-74517cf1 " name="li-74517cf1">§</a>
224224
Prefer build constraints to `runtime.GOOS`.
225225
226226
* <a href="#li-851dedf8" id="li-851dedf8" name="li-851dedf8">§</a>
227-
Prefer constants to variables where possible. Avoid global variables unless
228-
necessary. Use [constant errors] instead of `errors.New`.
227+
Prefer constants to variables where possible. Avoid global variables unless
228+
necessary. Use [constant errors] instead of `errors.New`.
229229
230230
* <a href="#li-3a7f3909" id="li-3a7f3909" name="li-3a7f3909">§</a>
231231
Prefer defining `Foo.String` and `ParseFoo` in terms of `Foo.MarshalText`
232232
and `Foo.UnmarshalText` correspondingly and not the other way around.
233233
234234
* <a href="#li-edd678a8" id="li-edd678a8" name="li-edd678a8">§</a>
235235
Prefer to use pointers to structs in function arguments, including method
236-
receivers, unless there is a reason to do the opposite. Among valid reasons
236+
receivers, unless there is a reason to do the opposite. Among valid reasons
237237
are:
238238
239239
* the struct is small, which typically means less than a few machine
@@ -262,8 +262,8 @@ The rules are mostly sorted in the alphabetical order.
262262
Don't forget to also [set the tab width][tab] in your editor's settings.
263263
264264
* <a href="#li-4bfdabf9" id="li-4bfdabf9" name="li-4bfdabf9">§</a>
265-
Use linters. `make go-lint`, if the project has one. A minimum of
266-
`go vet`, `errcheck`, and staticcheck if the project does not.
265+
Use linters. `make go-lint`, if the project has one. A minimum of `go vet`,
266+
`errcheck`, and staticcheck if the project does not.
267267
268268
* <a href="#li-29dc9ef0" id="li-29dc9ef0" name="li-29dc9ef0">§</a>
269269
When returning an error from a function that also returns a non-nilable
@@ -360,7 +360,7 @@ See also the [text guidelines][text].
360360

361361
* <a href="#li-dca638fe" id="li-dca638fe" name="li-dca638fe">§</a>
362362
Write names of RFCs without a hyphen and don't put a newline between the
363-
letters and the numbers. Godoc and pkg.go.dev both will add a link to the
363+
letters and the numbers. Godoc and pkg.go.dev both will add a link to the
364364
RFC, but only if the RFC is spelled that way.
365365
366366
So, do this:
@@ -386,16 +386,16 @@ See also the [text guidelines][text].
386386
387387
* <a href="#li-92230a03" id="li-92230a03" name="li-92230a03">§</a>
388388
Document important contracts (assertions, pre- and postconditions) of
389-
fields, functions and methods. That is, nilness of arguments, state of
390-
mutexes, relationship between struct fields, and so on. As an exception,
389+
fields, functions and methods. That is, nilness of arguments, state of
390+
mutexes, relationship between struct fields, and so on. As an exception,
391391
a method receiver can be generally considered to be required to be non-nil,
392392
unless a different behavior is explicitly documented.
393393
394394
For example:
395395
396396
```go
397397
// needsNonNil is an example of a method that requires a non-nil argument.
398-
// m must not be nil. r.mu is expected to be locked.
398+
// m must not be nil. r.mu is expected to be locked.
399399
func (r *Receiver) needsNonNil(m *Message) (err error) {
400400
// …
401401
}
@@ -406,7 +406,7 @@ See also the [text guidelines][text].
406406
## <a href="#errors" id="errors" name="errors">Error Handling</a>
407407
408408
* <a href="#li-651fcd50" id="li-651fcd50" name="li-651fcd50">§</a>
409-
Add context to errors but avoid duplication. For example, `os.Open` always
409+
Add context to errors but avoid duplication. For example, `os.Open` always
410410
adds the path to its error, so this is redundant:
411411
412412
```go
@@ -418,7 +418,7 @@ See also the [text guidelines][text].
418418
```
419419
420420
If a function returns enough context, or a deferred helper is used, document
421-
that. Prefer to use a standard comment across a project. For example:
421+
that. Prefer to use a standard comment across a project. For example:
422422
423423
```go
424424
err = f()
@@ -429,9 +429,9 @@ See also the [text guidelines][text].
429429
```
430430
431431
* <a href="#li-17e872ff" id="li-17e872ff" name="li-17e872ff">§</a>
432-
Avoid having multiple errors in a function. In situations when it's not
433-
feasible, use meaningful names. For example, `closeErr` for errors
434-
from `Close()` or `testErr` for subtest errors.
432+
Avoid having multiple errors in a function. In situations when it's not
433+
feasible, use meaningful names. For example, `closeErr` for errors from
434+
`Close()` or `testErr` for subtest errors.
435435

436436
* <a href="#li-9e172a2e" id="li-9e172a2e" name="li-9e172a2e">§</a>
437437
Avoid using the word `error` inside error messages.
@@ -463,7 +463,7 @@ See also the [text guidelines][text].
463463
project has its own conventions regarding uppercase letters.
464464

465465
* <a href="#li-6d1104bd" id="li-6d1104bd" name="li-6d1104bd">§</a>
466-
Use `panic` **only** to indicate critical assertion failures. **Do not**
466+
Use `panic` **only** to indicate critical assertion failures. **Do not**
467467
use panics for normal error handling.
468468

469469
* <a href="#li-f6d13b11" id="li-f6d13b11" name="li-f6d13b11">§</a>
@@ -500,7 +500,7 @@ See also the [text guidelines][text].
500500
with empty lines unless it's the only statement in that block.
501501
502502
* <a href="#li-82784b41" id="li-82784b41" name="li-82784b41">§</a>
503-
Don't group type declarations together. Unlike with blocks of `const`s,
503+
Don't group type declarations together. Unlike with blocks of `const`s,
504504
where a `iota` may be used or where all constants belong to a certain type,
505505
there is no reason to group `type`s.
506506

@@ -589,7 +589,7 @@ See also the [text guidelines][text].
589589

590590
* <a href="#li-46a924cd" id="li-46a924cd" name="li-46a924cd">§</a>
591591
Put deferred calls of destructors, for example `f.Close()`, into the same
592-
paragraph as constructors. This is an exception to the [paragraph
592+
paragraph as constructors. This is an exception to the [paragraph
593593
rule][par].
594594

595595
```go
@@ -613,7 +613,7 @@ See also the [text guidelines][text].
613613
```
614614

615615
* <a href="#li-f2156af9" id="li-f2156af9" name="li-f2156af9">§</a>
616-
Start a new paragraph after the final closing curly brace of a block. So
616+
Start a new paragraph after the final closing curly brace of a block. So
617617
this:
618618

619619
```go
@@ -654,7 +654,7 @@ See also the [text guidelines][text].
654654
* <a href="#li-d9b8f5a8" id="li-d9b8f5a8" name="li-d9b8f5a8">§</a>
655655
When a function's definition becomes [too long][long], first make the
656656
function's arguments vertically placed and only then do the same with the
657-
return values. That is, do this:
657+
return values. That is, do this:
658658

659659
```go
660660
func functionWithALongName(
@@ -725,7 +725,7 @@ See also the [text guidelines][text].
725725

726726
* <a href="#li-cc358586" id="li-cc358586" name="li-cc358586">§</a>
727727
Don't use underscores in file and package names, unless they're build tags
728-
or for tests. This is to prevent accidental build errors with weird tags.
728+
or for tests. This is to prevent accidental build errors with weird tags.
729729

730730
* <a href="#li-5a2d4941" id="li-5a2d4941" name="li-5a2d4941">§</a>
731731
For brands or words with more than 1 capital letter, lowercase all letters:
@@ -745,7 +745,7 @@ See also the [text guidelines][text].
745745
```
746746

747747
* <a href="#li-a3a30716" id="li-a3a30716" name="li-a3a30716">§</a>
748-
Name benchmarks and tests using the same convention as examples. For
748+
Name benchmarks and tests using the same convention as examples. For
749749
example:
750750

751751
```go
@@ -758,7 +758,7 @@ See also the [text guidelines][text].
758758
* <a href="#li-4b3adb1b" id="li-4b3adb1b" name="li-4b3adb1b">§</a>
759759
Name `context.Context` helper functions that return values from the context
760760
`FooFromContext` and the ones that return a new contest with new values,
761-
`ContextWithFoo` or `WithFoo`. Just like in the standard library, the
761+
`ContextWithFoo` or `WithFoo`. Just like in the standard library, the
762762
parent context should be called `parent`.
763763

764764
```go
@@ -863,15 +863,15 @@ See also the [text guidelines][text].
863863
```
864864

865865
* <a href="#li-a52e192a" id="li-a52e192a" name="li-a52e192a">§</a>
866-
Prefer to put all tests into a separate [test package][tpkg]. Tests in the
866+
Prefer to put all tests into a separate [test package][tpkg]. Tests in the
867867
same package that check unexported APIs should be put into a separate file
868868
named `foo_internal_test.go`.
869869

870870
* <a href="#li-b4f670ce" id="li-b4f670ce" name="li-b4f670ce">§</a>
871-
Strive to make the test suite finish quickly. If you have long-running
872-
integration test or fuzzes, document them, put them into a separate Makefile
873-
target, and include them into the CI pipeline, but not the main `make test`
874-
target.
871+
Strive to make the test suite finish quickly. If you have long-running
872+
integration test or fuzzes, document them, put them into a separate
873+
Makefile target, and include them into the CI pipeline, but not the main
874+
`make test` target.
875875

876876
* <a href="#li-9124bf62" id="li-9124bf62" name="li-9124bf62">§</a>
877877
Use `assert.NoError` and `require.NoError` instead of `assert.Nil` and

0 commit comments

Comments
 (0)