goid

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package goid returns the current goroutine's ID.

Get() is on the hottest path in the interpreter: every dynamic-var deref (Var.getDynamicBinding) and every thread-binding push/pop/clone keys off it. On supported configurations (see goid_fast.go) it is a two-instruction read of the runtime g struct's goid field; everywhere else it falls back to parsing runtime.Stack() output (getSlow below, the original vendored implementation). Selection is compile-time via build tags — ADR 0034.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get() int64

Get returns the current goroutine's ID via the runtime.Stack() text-parse — the portable fallback for arches or toolchains the fast path (goid_fast.go) has not been vetted on. Slow but always correct.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL