Skip to Content
marmot

Run cgo on the file's package and list each C function that the file calls, with its C prototype and how the call is made. A fast call is direct, because the C function calls nothing. A bracketed call releases the goroutine's P while C runs, because C may block or call back into Go. The list also shows the C types and variables that the file uses, with their Go definitions. It shows the file's //export functions as C sees them, and the package's #cgo flags. -go prints the file's Go code as marmot compiles it, -c its C wrappers.

Usage
marmot cgo show FILE.go [flags]

Examples

marmot cgo show main.go
marmot cgo show -go db.go
marmot cgo show -json db.go

marmot cgo show FILE.go lists each C function that the file calls, with its C prototype and its call path:

  • fast: the C function calls nothing, so the call is direct.
  • bracketed: the goroutine releases its P while C runs, because C can block or call back into Go.

It also shows the C types and variables that the file uses, its //export functions and the #cgo flags of the package. -go prints the Go code that marmot compiles, and -c the C wrappers.

Flags

Flags take one dash or two: -release and --release are the same.

FlagMeaning
-cprint the file's C wrappers
-color stringcolor in human output: auto, always or never (NO_COLOR turns auto off) (default "auto")
-goprint the file's Go code as marmot compiles it
-jsonmachine readable output: JSON Lines on stderr (also $MARMOT_OUTPUT=json, and the default under coding agents)

Full help

marmot cgo --help
Run cgo on the file's package and list each C function that the file calls, with its C prototype and how the call is made. A fast call is direct, because the C function calls nothing. A bracketed call releases the goroutine's P while C runs, because C may block or call back into Go. The list also shows the C types and variables that the file uses, with their Go definitions. It shows the file's //export functions as C sees them, and the package's #cgo flags. -go prints the file's Go code as marmot compiles it, -c its C wrappers.

Usage:
  marmot cgo show FILE.go [flags]

Examples:
marmot cgo show main.go
marmot cgo show -go db.go
marmot cgo show -json db.go

Flags:
      --c              print the file's C wrappers
      --color string   color in human output: auto, always or never (NO_COLOR turns auto off) (default "auto")
      --go             print the file's Go code as marmot compiles it
  -h, --help           help for cgo
      --json           machine readable output: JSON Lines on stderr (also $MARMOT_OUTPUT=json, and the default under coding agents)

On this page

Was this page helpful?

Report an issueOpen issues