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

template

package
v2.950.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: AGPL-3.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	TemplateDir               string   // The main template directory to use
	AdditionalSearchLocations []string // Additional directories to search for templates, templates/common is always added
	Subsystem                 *subsystem.Subsystem
	Debug                     bool
	DebugGojaPort             int // DAP debug port for goja JS runtime (0 = disabled)
	WriteFileFunc             WriteFileFunc
	ReadFileFunc              ReadFileFunc
	FileTracker               *filetracking.Tracker
	Ignore                    *filetracking.Ignore
	Comments                  *cms.CommentTracker
	Targeter                  Targeter
	Interopter                Interopter
	OutDir                    string
	ImportConfig              configuration.ImportConfig
	WatchTemplatesLocation    string
	Bucketer                  *buckettypes.Bucketer
}

type Engine

type Engine struct {
	*easytemplate.Engine
}

func New

func New(ctx context.Context, target types.Target, cfg Config) *Engine

type Interopter

type Interopter interface {
	ExecuteInterTemplateFunction(ctx context.Context, call easytemplate.CallContext, target types.Target, a *ast.AST, method string, args ...any) goja.Value
	ExecuteInterTemplateTarget(ctx context.Context, target string, outDir string, a *ast.AST, cfg map[string]any, enabledFeatures map[string]bool) error
	GetTargetDefaultTemplateConfig(ctx context.Context, target types.Target) (map[string]any, error)
}

type ReadFileFunc

type ReadFileFunc func(filename string) ([]byte, error)

type Targeter

type Targeter interface {
	GetTarget(ctx context.Context, target, outDir string) (types.Target, error)
}

type WarningLogger

type WarningLogger interface {
	LogWarning(ctx context.Context, msg string, err error)
}

type WriteFileFunc

type WriteFileFunc func(ctx context.Context, filename string, data []byte, perm fs.FileMode, checkExisting bool) error

Jump to

Keyboard shortcuts

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