Help us shape the future of Go! Take the 2026 Go Developer Survey

initpkg

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package initpkg implements `llcppg -init`, which bootstraps a new binding repository from the llcppg template. See the package-level Init function for the full behavior.

Index

Constants

View Source
const (
	// DefaultTemplateURL is the git URL of the llcppg project template.
	DefaultTemplateURL = "https://github.com/llarhub/.llcppg"

	// Placeholder is the token substituted with the module name in the files
	// listed by substituteFiles.
	Placeholder = "MODULE_NAME"
)

Variables

This section is empty.

Functions

func Init

func Init(dir, module string, opts *Config) error

Init bootstraps a new binding repository from the template, in the current repository rooted at dir. It:

  1. determines the module name (the given module, or the current directory's name when module is empty) and validates the environment (dir is a git repo, no existing c branch, no existing go.mod);
  2. prepares the template in the cache (clone on first use, update otherwise, falling back to the cached copy when offline);
  3. creates and commits a c branch with the template's c-branch files, with MODULE_NAME substituted in c/go.mod and c/llcppg.cfg;
  4. switches to the main branch (creating it only if it does not already exist) and commits the template's main-branch files, with MODULE_NAME substituted in go.mod and the standard badges inserted into README.md;
  5. leaves main checked out and reports what was done.

It never pushes, adds or modifies remotes, or changes git configuration.

Types

type Config

type Config struct {
	// TemplateURL is the git URL of the template repository. Empty means
	// DefaultTemplateURL.
	TemplateURL string

	// CacheDir is the directory that holds the cached template clone. required.
	CacheDir string

	// Stdout receives the human-readable progress and completion report. Empty
	// means os.Stdout.
	Stdout io.Writer

	// Stderr receives warnings (for example, the offline fallback notice).
	// Empty means os.Stderr.
	Stderr io.Writer
}

Config configures Init. The zero value uses the public template and the per-user cache directory; tests and advanced callers can override both.

Jump to

Keyboard shortcuts

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