install

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package install downloads prebuilt libds4 release assets for the ds4go CLI.

Index

Constants

View Source
const (
	// MetadataFileName is the name of the JSON metadata file written
	// alongside libds4 to record what is installed.
	MetadataFileName = "ds4go-install.json"

	// KindRelease marks metadata for a prebuilt asset downloaded from
	// GitHub. An empty Kind is treated as release for back-compat with
	// metadata written before pinning existed.
	KindRelease = "release"

	// KindPinned marks metadata for a developer-supplied libds4 copied in
	// via `install --pin`.
	KindPinned = "pinned"
)
View Source
const (
	// DefaultRepo is the GitHub repository used for prebuilt libds4 binaries.
	DefaultRepo = "NimbleMarkets/ds4"
)

Variables

This section is empty.

Functions

func FindDirHolders added in v0.4.0

func FindDirHolders(dirPath string) (map[int][]string, error)

FindDirHolders finds processes holding any files under dirPath. It returns a map of PID to a list of file paths they hold under that directory.

func PrintCatalog added in v0.5.1

func PrintCatalog(out io.Writer, catalog *CatalogResult)

PrintCatalog writes a human-readable install catalog.

func Status added in v0.4.0

func Status(ctx context.Context, opts Options) error

Status finds and displays processes holding the library.

func Uninstall added in v0.3.0

func Uninstall(ctx context.Context, opts Options) error

Uninstall removes the installed libds4 shared library, sidecar, and metadata files from opts.DestDir.

func Validate added in v0.3.0

func Validate(ctx context.Context, opts Options) error

Types

type CatalogAsset added in v0.5.1

type CatalogAsset struct {
	Name     string `json:"name"`
	URL      string `json:"url"`
	Digest   string `json:"digest,omitempty"`
	GOOS     string `json:"goos,omitempty"`
	GOARCH   string `json:"goarch,omitempty"`
	Backend  string `json:"backend,omitempty"`
	Archive  string `json:"archive,omitempty"`
	Parsed   bool   `json:"parsed"`
	Selected bool   `json:"selected"`
}

CatalogAsset describes one installable libds4 release asset.

type CatalogResult added in v0.5.1

type CatalogResult struct {
	Repo    string         `json:"repo"`
	Version string         `json:"version"`
	Assets  []CatalogAsset `json:"assets"`
}

CatalogResult describes the libds4 release assets available for installation.

func Catalog added in v0.5.1

func Catalog(ctx context.Context, opts Options) (*CatalogResult, error)

Catalog fetches the selected GitHub release and lists available libds4 assets. Empty GOOS, GOARCH, and Backend fields mean no filter. Backend "auto" is also treated as no filter because the catalog is informational.

type InstallMetadata added in v0.3.0

type InstallMetadata struct {
	Kind        string    `json:"kind,omitempty"`
	Repo        string    `json:"repo,omitempty"`
	Version     string    `json:"version,omitempty"`
	AssetName   string    `json:"asset_name,omitempty"`
	AssetURL    string    `json:"asset_url,omitempty"`
	Source      string    `json:"source,omitempty"`
	Backend     string    `json:"backend"`
	GOOS        string    `json:"goos"`
	GOARCH      string    `json:"goarch"`
	Digest      string    `json:"digest,omitempty"`
	SHA256      string    `json:"sha256"`
	InstalledAt time.Time `json:"installed_at"`
}

InstallMetadata holds information about the installed libds4.

Kind discriminates between the supported install sources:

  • "release" (or "" for back-compat with metadata written by older ds4go versions): a prebuilt asset downloaded from GitHub. Repo/Version/ AssetName/AssetURL/Digest are populated.
  • "pinned": a developer-supplied file copied in via `install --pin`. Source holds the absolute path the file was copied from.

type LsofProcess added in v0.4.0

type LsofProcess struct {
	PID   int
	Name  string
	Files []string
}

LsofProcess represents a process and its open files parsed from lsof.

type Options

type Options struct {
	Repo         string
	Version      string
	Backend      string
	GOOS         string
	GOARCH       string
	DestDir      string
	URL          string
	Pin          string // local libds4 file to copy in and mark pinned
	Asset        string
	Token        string
	Force        bool
	DryRun       bool
	SkipChecksum bool
	Out          io.Writer
	ProgressOut  io.Writer
	HTTPClient   *http.Client
	In           io.Reader
	Confirm      func(prompt string, defaultYes bool) (bool, error)
}

Options configures a libds4 installation.

type ProcessInfo added in v0.4.0

type ProcessInfo struct {
	PID  int
	Name string
}

ProcessInfo represents a process holding or using a shared library.

func FindLibraryHolders added in v0.4.0

func FindLibraryHolders(libPath string) ([]ProcessInfo, error)

FindLibraryHolders finds all processes holding onto the library path.

type Result

type Result struct {
	Repo       string
	Version    string
	Backend    string
	GOOS       string
	GOARCH     string
	AssetName  string
	AssetURL   string
	Library    string
	ChecksumOK bool
	DryRun     bool
}

Result describes the installed release asset.

func Run

func Run(ctx context.Context, opts Options) (*Result, error)

Run downloads, verifies when possible, and extracts a prebuilt libds4 asset.

Jump to

Keyboard shortcuts

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