@@ -31,54 +31,80 @@ var replacePatterns = []replacePattern{
3131 {`^composites: (\S+) composite literal uses unkeyed fields$` , "composites: `${1}` composite literal uses unkeyed fields" },
3232
3333 // gosec
34- {`^(\S+): Blacklisted import (\S+): weak cryptographic primitive$` ,
35- "${1}: Blacklisted import `${2}`: weak cryptographic primitive" },
34+ {
35+ `^(\S+): Blacklisted import (\S+): weak cryptographic primitive$` ,
36+ "${1}: Blacklisted import `${2}`: weak cryptographic primitive" ,
37+ },
3638 {`^TLS InsecureSkipVerify set true.$` , "TLS `InsecureSkipVerify` set true." },
3739
3840 // gosimple
3941 {`should replace loop with (.*)$` , "should replace loop with `${1}`" },
40- {`should use a simple channel send/receive instead of select with a single case` ,
41- "should use a simple channel send/receive instead of `select` with a single case" },
42- {`should omit comparison to bool constant, can be simplified to (.+)$` ,
43- "should omit comparison to bool constant, can be simplified to `${1}`" },
42+ {
43+ `should use a simple channel send/receive instead of select with a single case` ,
44+ "should use a simple channel send/receive instead of `select` with a single case" ,
45+ },
46+ {
47+ `should omit comparison to bool constant, can be simplified to (.+)$` ,
48+ "should omit comparison to bool constant, can be simplified to `${1}`" ,
49+ },
4450 {`should write (.+) instead of (.+)$` , "should write `${1}` instead of `${2}`" },
4551 {`redundant return statement$` , "redundant `return` statement" },
46- {`should replace this if statement with an unconditional strings.TrimPrefix` ,
47- "should replace this `if` statement with an unconditional `strings.TrimPrefix`" },
52+ {
53+ `should replace this if statement with an unconditional strings.TrimPrefix` ,
54+ "should replace this `if` statement with an unconditional `strings.TrimPrefix`" ,
55+ },
4856
4957 // staticcheck
5058 {`this value of (\S+) is never used$` , "this value of `${1}` is never used" },
51- {`should use time.Since instead of time.Now\(\).Sub$` ,
52- "should use `time.Since` instead of `time.Now().Sub`" },
53- {`should check returned error before deferring response.Close\(\)$` ,
54- "should check returned error before deferring `response.Close()`" },
59+ {
60+ `should use time.Since instead of time.Now\(\).Sub$` ,
61+ "should use `time.Since` instead of `time.Now().Sub`" ,
62+ },
63+ {
64+ `should check returned error before deferring response.Close\(\)$` ,
65+ "should check returned error before deferring `response.Close()`" ,
66+ },
5567 {`no value of type uint is less than 0$` , "no value of type `uint` is less than `0`" },
5668
5769 // unused
5870 {`(func|const|field|type|var) (\S+) is unused$` , "${1} `${2}` is unused" },
5971
6072 // typecheck
6173 {`^unknown field (\S+) in struct literal$` , "unknown field `${1}` in struct literal" },
62- {`^invalid operation: (\S+) \(variable of type (\S+)\) has no field or method (\S+)$` ,
63- "invalid operation: `${1}` (variable of type `${2}`) has no field or method `${3}`" },
74+ {
75+ `^invalid operation: (\S+) \(variable of type (\S+)\) has no field or method (\S+)$` ,
76+ "invalid operation: `${1}` (variable of type `${2}`) has no field or method `${3}`" ,
77+ },
6478 {`^undeclared name: (\S+)$` , "undeclared name: `${1}`" },
65- {`^cannot use addr \(variable of type (\S+)\) as (\S+) value in argument to (\S+)$` ,
66- "cannot use addr (variable of type `${1}`) as `${2}` value in argument to `${3}`" },
79+ {
80+ `^cannot use addr \(variable of type (\S+)\) as (\S+) value in argument to (\S+)$` ,
81+ "cannot use addr (variable of type `${1}`) as `${2}` value in argument to `${3}`" ,
82+ },
6783 {`^other declaration of (\S+)$` , "other declaration of `${1}`" },
6884 {`^(\S+) redeclared in this block$` , "`${1}` redeclared in this block" },
6985
7086 // golint
71- {`^exported (type|method|function|var|const) (\S+) should have comment or be unexported$` ,
72- "exported ${1} `${2}` should have comment or be unexported" },
73- {`^comment on exported (type|method|function|var|const) (\S+) should be of the form "(\S+) ..."$` ,
74- "comment on exported ${1} `${2}` should be of the form `${3} ...`" },
87+ {
88+ `^exported (type|method|function|var|const) (\S+) should have comment or be unexported$` ,
89+ "exported ${1} `${2}` should have comment or be unexported" ,
90+ },
91+ {
92+ `^comment on exported (type|method|function|var|const) (\S+) should be of the form "(\S+) ..."$` ,
93+ "comment on exported ${1} `${2}` should be of the form `${3} ...`" ,
94+ },
7595 {`^should replace (.+) with (.+)$` , "should replace `${1}` with `${2}`" },
76- {`^if block ends with a return statement, so drop this else and outdent its block$` ,
77- "`if` block ends with a `return` statement, so drop this `else` and outdent its block" },
78- {`^(struct field|var|range var|const|type|(?:func|method|interface method) (?:parameter|result)) (\S+) should be (\S+)$` ,
79- "${1} `${2}` should be `${3}`" },
80- {`^don't use underscores in Go names; var (\S+) should be (\S+)$` ,
81- "don't use underscores in Go names; var `${1}` should be `${2}`" },
96+ {
97+ `^if block ends with a return statement, so drop this else and outdent its block$` ,
98+ "`if` block ends with a `return` statement, so drop this `else` and outdent its block" ,
99+ },
100+ {
101+ `^(struct field|var|range var|const|type|(?:func|method|interface method) (?:parameter|result)) (\S+) should be (\S+)$` ,
102+ "${1} `${2}` should be `${3}`" ,
103+ },
104+ {
105+ `^don't use underscores in Go names; var (\S+) should be (\S+)$` ,
106+ "don't use underscores in Go names; var `${1}` should be `${2}`" ,
107+ },
82108}
83109
84110type IdentifierMarker struct {
0 commit comments