libcmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Run

func Run(args []string, stdout, stderr io.Writer) int

Run is "ext bundle": it runs fetch or bind with args and returns the exit code.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL