Skip to content

Commit

Permalink
Fix npe golang/go#60555
Browse files Browse the repository at this point in the history
  • Loading branch information
chiahan1123 committed Sep 4, 2023
1 parent ece95c7 commit de6b410
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions message/pipeline/extract.go
Expand Up @@ -108,10 +108,12 @@ func Extract(c *Config) (*State, error) {
key := []string{}
if ident, ok := args[0].(*ast.Ident); ok {
key = append(key, ident.Name)
if v, ok := ident.Obj.Decl.(*ast.ValueSpec); ok && v.Comment != nil {
// TODO: get comment above ValueSpec as well
comment = v.Comment.Text()
}
if ident.Obj != nil {
if v, ok := ident.Obj.Decl.(*ast.ValueSpec); ok && v.Comment != nil {
// TODO: get comment above ValueSpec as well
comment = v.Comment.Text()
}
}
}

arguments := []argument{}
Expand Down

0 comments on commit de6b410

Please sign in to comment.