Debian Codegraph @

stylecheck/st1005/testdata/go1.0/CheckErrorStrings/CheckErrorStrings.go

raw
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") //@ diag(`error strings should not be capitalized`)
9 errors.New("also not a great error.") //@ diag(`error strings should not end with punctuation or newlines`)
10 errors.New("URL is okay")
11 errors.New("SomeFunc is okay")
12 errors.New("URL is okay, but the period is not.") //@ diag(`error strings should not end with punctuation or newlines`)
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 errors.New("P384 is a nice curve")
18 }
19
20 func Write() {
21 errors.New("Write: this is broken")
22 }
23
24 type T struct{}
25
26 func (T) Read() {
27 errors.New("Read: this is broken")
28 errors.New("Read failed")
29 }
30
31 func fn2() {
32 // The error string hasn't to be in the same function
33 errors.New("Read failed")
34 }