Golang go/ast.FilterDecl() function example
package go/ast
FilterDecl trims the AST for a Go declaration in place by removing all names (including struct field and interface method names, but not from parameter lists) that don't pass through the filter f.
FilterDecl returns true if there are any declared names left after filtering; it returns false otherwise.
Golang go/ast.FilterDecl() function usage example
func filterFile(src *File, f Filter, export bool) bool {
j := 0
for _, d := range src.Decls {
if filterDecl(d, f, export) { // <-- here
src.Decls[j] = d
j++
}
}
src.Decls = src.Decls[0:j]
return j > 0
}
References :
Advertisement
Something interesting
Tutorials
+6.2k Golang : Get Hokkien(福建话)/Min-nan(閩南語) Pronounciations
+13k Golang : Get terminal width and height example
+11.9k Golang : How to parse plain email text and process email header?
+13.6k Golang : Query string with space symbol %20 in between
+12.1k Golang : Decompress zlib file example
+6.8k Golang : Muxing with Martini example
+6.5k Grep : How to grep for strings inside binary data
+25.6k Golang : convert rune to integer value
+7.2k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+9.7k Golang : Eroding and dilating image with OpenCV example
+10.2k Golang : Bcrypting password
+10.2k Golang : How to profile or log time spend on execution?