cgo

package
Version: v0.7.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(bp *build.Package, pkgdir, tmpdir string, useabs bool) (files, displayFiles []string, err error)

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.

Types

type File

type File struct {
	Filename string
	*ast.File
}

File the 'ast.File' with filename

func ProcessFiles

func ProcessFiles(bp *build.Package, fset *token.FileSet, DisplayPath func(path string) string, mode parser.Mode) ([]*File, error)

ProcessFiles invokes the cgo preprocessor on bp.CgoFiles, parses the output and returns the resulting ASTs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL