Standard library / go/doc

go/doc.ToText()

Legacy plain-text conversion with configurable prefix and width; prefer Package.Text. Expected stdout: '> Hello\n'.

Formal Syntax & Structure

go syntaxgo
func ToText(w io.Writer, text string, prefix, codePrefix string, width int)

Parameters & Attributes

NameTypeDescription
wio.WriterInput to the operation as described above.
textstringInput to the operation as described above.
prefixstringInput to the operation as described above.
codePrefixstringInput to the operation as described above.
widthintInput to the operation as described above.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt"  "go/doc")
func main() { var b bytes.Buffer; doc.ToText(&b, "Hello", "> ", "  ", 80); fmt.Print(b.String()) }
Go Reference