Standard library / go/types
go/types.NewLabel()
Creates a label object for a control-flow target. Expected stdout: 'Start\n'.
Formal Syntax & Structure
go syntaxgo
func NewLabel(pos token.Pos, pkg *Package, name string) *LabelParameters & Attributes
| Name | Type | Description |
|---|---|---|
| pos | token.Pos | Source position in the associated file set. |
| pkg | *Package | Package containing the symbol; nil for package-independent objects. |
| name | string | Name of the symbol or package. |
Return Value
*Label
Creates a label object for a control-flow target.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { l := types.NewLabel(0, nil, "Start"); fmt.Println(l.Name()) }