Skip to content

Commit

Permalink
Support ignore comment alongside godoc (#731)
Browse files Browse the repository at this point in the history
Fixes #710
  • Loading branch information
cretz authored Feb 22, 2022
1 parent 2c19379 commit 621fd1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contrib/tools/workflowcheck/determinism/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,12 @@ func updateIgnoreMap(fset *token.FileSet, f *ast.File, m map[ast.Node]struct{})
// Collect only the ignore comments
var comments []*ast.CommentGroup
for _, group := range f.Comments {
if len(group.List) == 1 && strings.HasPrefix(group.List[0].Text, "//workflowcheck:ignore") {
comments = append(comments, group)
// Check each comment in list so Godoc and others can be in any order
for _, comment := range group.List {
if strings.HasPrefix(comment.Text, "//workflowcheck:ignore") {
comments = append(comments, group)
break
}
}
}
// Bail if no comments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func IgnoreAboveLine() { // want IgnoreAboveLine:"calls non-deterministic functi
}

//workflowcheck:ignore
// IgnoreEntireFunction can have a Godoc comment too
func IgnoreEntireFunction() {
fmt.Print("Do not ignore this")
fmt.Printf("Ignore this")
Expand Down

0 comments on commit 621fd1e

Please sign in to comment.