templates

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package templates holds the guest PowerShell scripts shipped by winkit.

Guest scripts live as files under this directory, never as Go raw strings.

PowerShell's escape character is the backtick — the same character that delimits a Go raw string — so a script needing `n, `t or a line continuation cannot be written inline at all. That is not hypothetical: writing `Staged` inside a comment terminated a raw string and broke the build on 2026-07-31. Splicing Go constants also forced scripts to close and reopen their string mid-line, which is how a `"$env:USERNAME:(R)"` interpolation bug survived review. Template fields remove both hazards, and the scripts become syntax-highlightable, greppable files.

Layout: <domain>/<name>.ps1.tmpl — provision/ for build-time provisioning, devenv/ for dev-environment setup, partials/ for shared fragments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(path string, data any) string

Render renders a guest script by path relative to this package.

A template that fails to parse or execute is a programming error, not a runtime condition: the data comes from our own config structs, so there is no input a user could supply to trigger it. Panicking keeps every caller's signature free of an error that cannot happen in practice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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