prettyprint

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package prettyprint formats any go value in a way that is similar to the equivalent literal in a go source file. However, for the purpose of displaying intelligible values during testing, some details are elided, long string are line-wrapped with wrap delimiters, and long sequences are potentially truncated in the middle.

Index

Constants

This section is empty.

Variables

View Source
var Default = New()

Default is the default pretty-printer with globally chared config

Functions

func FormatValue

func FormatValue(v interface{}) string

FormatValue return a formated value using the default shared pretty-printer

Types

type Formatter

type Formatter struct {
	Width      int
	WrapPrefix string
	WrapSuffix string
	MaxWrapped int

	IndentStr  string
	NewlineStr string
}

Formatter contains the configuration

func New

func New() *Formatter

New return a new pretty-printer that can be customized and used locally

func (*Formatter) FormatValue

func (f *Formatter) FormatValue(v interface{}) string

FormatValue return the value formated according to the local settings

Jump to

Keyboard shortcuts

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