Skip to content

Commit

Permalink
feat: Add MockGen header to generated code ignore checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lieut-data committed Jan 15, 2025
1 parent 341b0b5 commit b3bc489
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion license/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
ignoreFiles = strings.Split(ignoreFilesPattern, ",")
}
const mockeryHeader = "// Code generated by mockery"
const mockGenHeader = "// Code generated by MockGen. DO NOT EDIT."
const goGenerateHeader = "//go:generate"
const bindataHeader = "by go-bindata DO NOT EDIT. (@generated)"
const buildTag = "// +build"
Expand Down Expand Up @@ -75,7 +76,8 @@ func run(pass *analysis.Pass) (interface{}, error) {
continue
}

if strings.HasPrefix(file.Comments[0].List[0].Text, mockeryHeader) {
if strings.HasPrefix(file.Comments[0].List[0].Text, mockeryHeader) ||
strings.HasPrefix(file.Comments[0].List[0].Text, mockGenHeader) {
continue
}

Expand Down

0 comments on commit b3bc489

Please sign in to comment.