scaffold

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package scaffold holds shared codegen output helpers used by the apic code generators under helpers/* (wsgen, mcpgen, fn, noop, httpgentest). QG-025: it removes the duplicated "format the assembled source, then write it to disk" logic each helper previously carried inline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(name string, src []byte) ([]byte, error)

Format formats src with goimports grouping and returns the canonical bytes. QG-037/QG-015/QG-075: all generated Go output must be byte-stable under BOTH `gofmt -l` and `goimports -l`. go/format.Source only gofmt-sorts within a single import block and never regroups stdlib vs third-party; imports.Process with FormatOnly:true adds the canonical grouping on top of gofmt formatting without ever adding or deleting an import (mirrors cmd/apic/templates.go renderToFile). name is used only for error context. A formatting error is returned with no bytes so a malformed emission fails loud rather than producing an un-formattable file.

func FormatAndWrite

func FormatAndWrite(path string, src []byte, perm os.FileMode) error

FormatAndWrite formats src with goimports grouping (see Format) and writes the canonical result to path with the given permission bits. A formatting error is returned with the source unwritten.

Types

This section is empty.

Jump to

Keyboard shortcuts

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