Golang go/ast.Comment type example

package go/ast

A Comment node represents a single //-style or /*-style comment.

Golang go/ast.Comment type usage example

  func NodeDescription(n ast.Node) string {
 switch n := n.(type) {
 case *ast.ArrayType:
 return "array type"
 case *ast.AssignStmt:
 return "assignment"
 case *ast.Comment:
 return "comment"
 ...
  }

Reference :

http://golang.org/pkg/go/ast/#Comment

Advertisement