.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / honnef.co / go / tools@v0.1.1 / stylecheck / testdata / src / CheckErrorStrings / CheckErrorStrings.go
1 // Package pkg ...
2 package pkg
3
4 import "errors"
5
6 func fn() {
7         errors.New("a perfectly fine error")
8         errors.New("Not a great error")       // want `error strings should not be capitalized`
9         errors.New("also not a great error.") // want `error strings should not end with punctuation or a newline`
10         errors.New("URL is okay")
11         errors.New("SomeFunc is okay")
12         errors.New("URL is okay, but the period is not.") // want `error strings should not end with punctuation or a newline`
13         errors.New("T must not be nil")
14         errors.New("Foo() failed")
15         errors.New("Foo(bar) failed")
16         errors.New("Foo(bar, baz) failed")
17 }
18
19 func Write() {
20         errors.New("Write: this is broken")
21 }
22
23 type T struct{}
24
25 func (T) Read() {
26         errors.New("Read: this is broken")
27         errors.New("Read failed")
28 }
29
30 func fn2() {
31         // The error string hasn't to be in the same function
32         errors.New("Read failed")
33 }