Skip to content

Instantly share code, notes, and snippets.

@joshlf
joshlf / reflection.go
Created January 5, 2014 20:17
"go build" can be passed linker flags. If the "-s" flag is passed to remove debugging information, runtime reflection can break. Try building with 'go build' and with 'go build -ldflags "-s"' separately.
package main
import (
"fmt"
"reflect"
"runtime"
)
func main() {
fmt.Println(runtime.FuncForPC(reflect.ValueOf(main).Pointer()).Name())
@joshlf
joshlf / sleepsort.go
Created November 21, 2013 16:18
Sleepsort (golang)
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
ints := rand.Perm(100)