extractNodeSource returns the verbatim source text covered by node in src.
(src []byte, fset *token.FileSet, node ast.Node)
| 25 | |
| 26 | // extractNodeSource returns the verbatim source text covered by node in src. |
| 27 | func extractNodeSource(src []byte, fset *token.FileSet, node ast.Node) string { |
| 28 | start := fset.Position(node.Pos()).Offset |
| 29 | end := fset.Position(node.End()).Offset |
| 30 | if start < 0 || end > len(src) || start > end { |
| 31 | return "" |
| 32 | } |
| 33 | return string(src[start:end]) |
| 34 | } |
| 35 | |
| 36 | // checkOrphanDirectives returns an error for the first comment that matches re |
| 37 | // but whose source line was not consumed by a declaration. |
no outgoing calls
no test coverage detected