Skip to content

Commit

Permalink
Add more exceptions for tags in comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krivak committed Jul 22, 2020
1 parent 3bb859c commit 6c53b26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions godot.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ var (
// List of valid last characters.
lastChars = []string{".", "?", "!"}

// Special tags in comments like "nolint" or "build".
tags = regexp.MustCompile("^[a-z]+:")
// Special tags in comments like "// nolint:", or "// +k8s:".
tags = regexp.MustCompile(`^\+?[a-z0-9]+:`)

// Special hashtags in comments like "#nosec".
hashtags = regexp.MustCompile("^#[a-z]+ ")
Expand Down
6 changes: 6 additions & 0 deletions godot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ func TestCheckComment(t *testing.T) {
ok: true,
pos: position{},
},
{
name: "singleline comment: kubernetes tag",
comment: "// +k8s:deepcopy-gen=package",
ok: true,
pos: position{},
},
{
name: "singleline comment: cgo exported function",
comment: "//export FuncName",
Expand Down

0 comments on commit 6c53b26

Please sign in to comment.