I'm a java programer and I'm learning Go. Now I can use GDB simply and I have a doubt, when I debugging a Go program ,I can't check an object(or variable) what it exactly is. e.g. when I debug a java program,I can check everything in an object(or variable).
public void catTest() {
Cat cat1=new Cat("Kitty", 2, "white");
/*AnyThing*/
cat1.jump();
}
When I debug this java method using eclipse-debug mode,what in cat1 are obviously in the whole process. Details of Variable cat1
When I debug a go program,I try to check variable w by using command print w
or info args
.
func sayhelloName(w http.ResponseWriter, r *http.Request) {
r.ParseForm()
fmt.Println(r.Form)
fmt.Println("path", r.URL.Path)
fmt.Println("scheme", r.URL.Scheme)
fmt.Println(r.Form["url_long"])
for k, v := range r.Form {
fmt.Println("key:", k)
fmt.Println("val:", strings.Join(v, ""))
}
fmt.Fprintf(w, "Hello astaxie!")
}
I can just get this but not what inside about variable w.
$2 = {tab = 0x81c2e0, data = 0x11156990}