Standard library / runtime

runtime.StackRecord

Fixed-size array of program counters. Stack exposes the used prefix up to the first zero; synthetic PCs are for representation only. Expected stdout: '2\n'.

Formal Syntax & Structure

go syntaxgo
type StackRecord struct {  Stack0 [32]uintptr}

Working Example

Example Snippetgo
package main
import (  "fmt"  "runtime")
func main() { r := runtime.StackRecord{Stack0: [32]uintptr{1, 2}}; fmt.Println(len(r.Stack())) }
Go Reference