printer

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 1 Imported by: 8 modules, 25 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

printer

This directory contains code for generating files of code.

Documentation

Overview

Package printer provides support for writing generated code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Code

type Code struct {
	// contains filtered or unexported fields
}

Code represents a file of code to be printed.

func (*Code) Indent

func (c *Code) Indent()

Indent adds one level of indentation.

func (*Code) Outdent

func (c *Code) Outdent()

Outdent remvoes one level of indentation.

func (*Code) Print

func (c *Code) Print(args ...interface{})

Print adds a line of code using the current indentation. Accepts printf-style format strings and arguments.

func (*Code) PrintIf added in v0.3.0

func (c *Code) PrintIf(condition bool, args ...interface{})

PrintIf adds a line of code using the current indentation if a condition is true. Accepts printf-style format strings and arguments.

func (*Code) String

func (c *Code) String() string

String returns the accumulated code as a string.

Jump to

Keyboard shortcuts

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