Standard library / go/types
go/types.WriteSignature()
Writes a signature without the leading func keyword to a buffer. Expected stdout: '()\n'.
Formal Syntax & Structure
go syntaxgo
func WriteSignature(buf *bytes.Buffer, sig *Signature, qf Qualifier)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| buf | *bytes.Buffer | Input to the operation as described above. |
| sig | *Signature | Input to the operation as described above. |
| qf | Qualifier | Optional package-name qualifier for formatted type names. |
Working Example
Example Snippetgo
package main
import ( "bytes" "fmt" "go/types")
func main() { var b bytes.Buffer types.WriteSignature(&b, types.NewSignatureType(nil, nil, nil, nil, nil, false), nil) fmt.Println(b.String())}