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

input

package
v8.149.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TemplateSHA added in v8.64.2

func TemplateSHA(files fs.FS, name string) string

TemplateSHA is the provenance link a generated file's header carries for the template name: the content of name.sha next to the template, which `go generate` writes from the last commit that touched the template (update-template-sha.go) and which is gitignored. In a build of devctl as a module dependency the .sha files are absent — the module zip holds only what is committed — and the link points at the module version's tree instead, so the gen packages compile from the module proxy.

Types

type Input

type Input struct {
	// If delete is true, the file will be deleted if it exists. Allows
	// for files to be moved/renamed.
	Delete bool
	// Path is the absolute path of the file to be generated from this
	// Input.
	Path string
	// Permissions to generate the file with.
	Permissions fs.FileMode
	// TemplateBody is the Go text template from which the file is
	// generated.
	TemplateBody string
	// TemplateData defines data for the template defined in TemplateBody.
	TemplateData interface{}
	// TemplateDelims are used to call
	// https://golang.org/pkg/text/template/#Template.Delims if set.
	TemplateDelims InputTemplateDelims
	// SkipRegenCheck if set skips over the `isRegenerable` check when creating files
	SkipRegenCheck bool
	// Generate, when set, produces the file's content directly instead of
	// executing TemplateBody. Used for content that isn't template-shaped Go
	// text, e.g. computed by calling another library in-process (such as
	// helm/<chart>/values.schema.json, see the precommit input package).
	// Generate and TemplateBody are mutually exclusive: an Input that sets
	// both is rejected.
	Generate func(ctx context.Context) ([]byte, error)
}

type InputTemplateDelims

type InputTemplateDelims struct {
	Left  string
	Right string
}

Jump to

Keyboard shortcuts

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