// ProcessFiles invokes the cgo preprocessor on bp.CgoFiles, parses // the output and returns the resulting ASTs. func ProcessFiles(bp *build.Package, fset *token.FileSet, DisplayPath func(path string) string, mode parser.Mode) ([]*ast.File, error) { … } var cgoRe … // Run invokes the cgo preprocessor on bp.CgoFiles and returns two // lists of files: the resulting processed files (in temporary // directory tmpdir) and the corresponding names of the unprocessed files. // // Run is adapted from (*builder).cgo in // $GOROOT/src/cmd/go/build.go, but these features are unsupported: // Objective C, CGOPKGPATH, CGO_FLAGS. // // If useabs is set to true, absolute paths of the bp.CgoFiles will be passed in // to the cgo preprocessor. This in turn will set the // line comments // referring to those files to use absolute paths. This is needed for // go/packages using the legacy go list support so it is able to find // the original files. func Run(bp *build.Package, pkgdir, tmpdir string, useabs bool) (files, displayFiles []string, err error) { … } // Return the flags to use when invoking the C or C++ compilers, or cgo. func cflags(p *build.Package, def bool) (cppflags, cflags, cxxflags, ldflags []string) { … } // envList returns the value of the given environment variable broken // into fields, using the default value when the variable is empty. func envList(key, def string) []string { … } // stringList's arguments should be a sequence of string or []string values. // stringList flattens them into a single []string. func stringList(args ...interface{ … }