Skip to content

Instantly share code, notes, and snippets.

@arc279
Last active November 17, 2015 08:48
Show Gist options
  • Save arc279/f5442fde14f6fd5f7d0d to your computer and use it in GitHub Desktop.
Save arc279/f5442fde14f6fd5f7d0d to your computer and use it in GitHub Desktop.
golang dump check
package main
import (
"fmt"
)
type Data struct {
a int
b int
}
type Hoge struct{}
func (me *Hoge) AwsomeProc(you *Hoge, a int, b string, c *Data, d Data) {
fmt.Printf("%p\n", me)
fmt.Println(*(*Hoge)(nil)) // nilの中身を触って死ぬ
}
func main() {
a := Hoge{}
a.AwsomeProc((*Hoge)(nil), 4, "msg", &Data{a: 8, b: 16}, Data{a: 32, b: 64})
(*Hoge)(nil).AwsomeProc(&a, 4, "msg", &Data{a: 8, b: 16}, Data{a: 32, b: 64})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment