package
Version:
v2.7.0
Opens a new window with list of versions in this module.
Published: Nov 10, 2025
License: Apache-2.0
Opens a new window with license information.
Imports: 9
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package resource provides utilities for tracking resource lifetimes.
Track tracks the lifetime of an object until Untrack is called on it.
Obj should be a pointer to a struct with a field "token" of type *Token.
func Untrack[T any](obj *T, token *Token)
Untrack stops tracking the lifetime of an object.
It is safe to call this function multiple times concurrently.
Token is a field of a tracked object, holding the cleanup handle and a cleanup function with message.
NewToken returns a new Token.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.