Skip to content

Instantly share code, notes, and snippets.

View joetIO's full-sized avatar
🎯

JoeT joetIO

🎯
View GitHub Profile
@joetIO
joetIO / isChanClosed.go
Last active January 31, 2022 10:32
Checks if a Go channel is closed without touching/reading it (a very bad idea please do not use :) i was like 16 years old when i wrote this hacking go runtime, it's just a nice hack but def not memory safe lmao)
package main
import (
"fmt"
"unsafe"
"reflect"
)
func isChanClosed(ch interface{}) bool {