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
| Name | Type | Description |
|---|---|---|
| w | io.Writer | Input to the operation as described above. |
| text | string | Input to the operation as described above. |
| prefix | string | Input to the operation as described above. |
| codePrefix | string | Input to the operation as described above. |
| width | int | Input 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()) }