Skip to content

Commit

Permalink
Merge branch 'uber-go:main' into v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lverma14 authored Apr 3, 2024
2 parents 4be47ca + ed5a8e8 commit ef652ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ func checkGeneratedCode(f *ast.File) bool {
if ast.IsGenerated(f) {
return true
}
if f.Doc == nil {
return false
}
for _, comm := range f.Doc.List {
if strings.Contains(comm.Text, "@generated") {
return true
Expand Down
4 changes: 4 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ func TestCheckGeneratedCode(t *testing.T) {
},
},
},
{
name: "non-generated code with no package comment",
file: &ast.File{},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit ef652ca

Please sign in to comment.