gid

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gid provides goroutine ID retrieval with multiple provider implementations. It automatically selects the best available provider at runtime.

Provider priority: petermattis/goid > unsafe (getg) > slow (runtime.Stack)

Build tags:

  • goid_nopeter: Disable petermattis/goid provider
  • goid_unsafe: Enable unsafe provider (opt-in)
  • goid_noslow: Disable slow provider (not recommended)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGID

func GetGID() int64

GetGID returns the current goroutine ID. This is the main API that should be used by all callers.

func GetProviderName

func GetProviderName() string

GetProviderName returns the name of the active provider. Useful for debugging and logging.

Types

type Provider

type Provider interface {
	// Get returns the current goroutine ID.
	Get() int64
	// Name returns the provider name for logging/debugging.
	Name() string
	// Available returns true if the provider is available.
	Available() bool
}

Provider defines the interface for goroutine ID providers.

Jump to

Keyboard shortcuts

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