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
+14.4k Android Studio : Use image as AlertDialog title with custom layout example
+15.2k Golang : How to add color to string?
+7.9k Golang : Gomobile init produce "iphoneos" cannot be located error
+25.8k Golang : Daemonizing a simple web server process example
+11.3k Golang : Fix fmt.Scanf() on Windows will scan input twice problem
+16.8k Golang : read gzipped http response
+21.9k Golang : Use TLS version 1.2 and enforce server security configuration over client
+13.5k Golang : Read XML elements data with xml.CharData example
+4.7k MariaDB/MySQL : Form select statement or search query with Chinese characters
+22.7k Golang : Strings to lowercase and uppercase example
+4.7k Chrome : How to block socketloop.com links in Google SERP?
+5.6k PHP : Convert string to timestamp or datestamp before storing to database(MariaDB/MySQL)