Documentation
¶
Overview ¶
Package libcmd is the command that brings a C library of lib/ into a Go project before it builds: ext's builtin "ext bundle". ext-go has no command of its own; a project adds ext as a Go tool and runs it from go generate:
go get -tool github.com/webong/ext/cmd/ext //go:generate go tool ext bundle fetch -lib plugin -driver cgo //go:generate go tool ext bundle bind -lib plugin
fetch reads the library's citation (a library.Citation: where each platform's build is published and its SHA-256), downloads the builds for the targets, checks them, and writes a Go package the project blank-imports. bind writes a typed Go binding of the library from the description of its interface (library.Description; lib/plugin's interface.json). Where they write, and what, comes from the flags, then EXT_GO_DIR (the directory), then ext-go.json in the module root, then the defaults:
{
"dir": "internal/extlib", // the parent of every library's package
"libraries": {
"plugin": {
"citation": "third_party/ext_plugin.citation.json", // the pin, committed to the project
"description": "third_party/ext_plugin.interface.json", // what bind binds
"drivers": ["cgo"],
"targets": ["linux/amd64", "darwin/arm64"]
}
}
}
The default directory is internal/extlib/<library> in the module (bind writes <library>bind beside it), since cgo and c2go output is compiled with the project; the default target is the one go env reports, and the default driver is cgo when cgo is enabled and purego when it is not.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.