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

NameTypeDescription
buf*bytes.BufferInput to the operation as described above.
sig*SignatureInput to the operation as described above.
qfQualifierOptional 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())}
Go Reference