Make + Value
p := &User{Name: "Ada"}
w := weak.Make(p)
// later:
if u := w.Value(); u != nil {
fmt.Println(u.Name) // still alive
} else {
// the target was collected
}
weakWeak pointers — references that don't prevent GC (Go 1.24+). Build caches and maps that shouldn't keep values alive.
p := &User{Name: "Ada"}
w := weak.Make(p)
// later:
if u := w.Value(); u != nil {
fmt.Println(u.Name) // still alive
} else {
// the target was collected
}