Last active
November 17, 2015 08:48
-
-
Save arc279/f5442fde14f6fd5f7d0d to your computer and use it in GitHub Desktop.
golang dump check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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