Closed gfariasalves-ionos closed 2 months ago
Describe the bug Some projects like Kubebuilder have markers that do not follow the pattern //name:, example: //+optional. Due to https://github.com/mgechev/revive/blob/f88f60da20b2cdc9db2ad6ce5978da32531b0cda/rule/comment-spacings.go#L34 having a colon added at the end they don't work.
//name:
//+optional
To Reproduce Steps to reproduce the behavior:
Write this config file:
[rule.comment-spacings] arguments = ["+optional"]
Write this test file:
package main
import "fmt"
// example is an example struct //+optional type example struct { a int }
func main() { a := example{a: 1} fmt.Println(a.a) }
**Expected behavior** I don't get an error **Logs** I get an error (logs from golangci-lint but the idea is the same):
comment-spacings: no space between comment delimiter and comment text (revive) //+optional ^
**Desktop (please complete the following information):** - OS: OpenSUSE Tumbleweed - Version of Go: 1.22
Hi @gfariasalves-ionos, thanks for reporting the issue. As you already pointed out, removing the : from line 34 of the rule will fix the problem. (PR are welcome)
:
I'll create one :)
Describe the bug Some projects like Kubebuilder have markers that do not follow the pattern
//name:
, example://+optional
. Due to https://github.com/mgechev/revive/blob/f88f60da20b2cdc9db2ad6ce5978da32531b0cda/rule/comment-spacings.go#L34 having a colon added at the end they don't work.To Reproduce Steps to reproduce the behavior:
Write this config file:
Write this test file:
import "fmt"
// example is an example struct //+optional type example struct { a int }
func main() { a := example{a: 1} fmt.Println(a.a) }
comment-spacings: no space between comment delimiter and comment text (revive) //+optional ^