Golang go/ast.PackageExports() function example
package go/ast
PackageExports trims the AST for a Go package in place such that only exported nodes remain. The pkg.Files list is not changed, so that file names and top-level package comments don't get lost.
PackageExports returns true if there are exported declarations; it returns false otherwise.
Golang go/ast.PackageExports() function usage example
var astFile *ast.File
var filename string
astPkg := ast.Package{
Name : "test",
Files : map[string]*ast.File {
filename : astFile,
},
}
ast.PackageExports(&astPkg)
Reference :
Advertisement
Something interesting
Tutorials
+6.3k WARNING: UNPROTECTED PRIVATE KEY FILE! error message
+6.2k Linux/Unix : Commands that you need to be careful about
+18.3k Golang : Get path name to current directory or folder
+9k Golang : Capture text return from exec function example
+7.9k Setting $GOPATH environment variable for Unix/Linux and Windows
+12.7k Golang : Send data to /dev/null a.k.a blackhole with ioutil.Discard
+12.2k Golang : calculate elapsed run time
+7.4k Golang : How to detect if a sentence ends with a punctuation?
+14k Golang : Compress and decompress file with compress/flate example
+7.7k Golang : get the current working directory of a running program
+11.3k Golang : Intercept and process UNIX signals example
+7.1k Golang : Squaring elements in array