scriptfmt

package
v1.138.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package scriptfmt is the one format every managed script is stored in (#1937): the Starlark printer from github.com/bazelbuild/buildtools, without its rewrites, applied on every save so no agent has to think about layout and no diff between two versions is noise.

It lays the source out and changes nothing else: keyword arguments are written key = value, the items of a multi-line list or dict go one per line, strings take double quotes, and every comment is kept. The rewrites the printer can also apply (sorting some lists and load statements) are for Bazel BUILD files and are not used, since reordering a script's lists could change what it does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(source string) string

Format returns source in the canonical format. The printed source is used only when the dialect parses it into the same program -- the same syntax tree, literal values and comments -- as the source sent; otherwise the source is returned as it was. The dialect is the authority on what a script is, so a save is never refused, and never changed in meaning, because of how the printer laid it out.

Types

This section is empty.

Jump to

Keyboard shortcuts

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