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) *Label

Parameters & Attributes

NameTypeDescription
postoken.PosSource position in the associated file set.
pkg*PackagePackage containing the symbol; nil for package-independent objects.
namestringName 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()) }
Go Reference