这是示例代码:

package main

import (
    "fmt"
)

type A struct {
    Name string
}

func (this *A) demo(tag string) {
    fmt.Printf("%#v\n",this)
    fmt.Println(tag)
}

func main() {
    var ele A
    ele.demo("ele are called")

    ele2 := A{}
    ele2.demo("ele2 are called")
}

运行结果:

&main.A{Name:""}
ele are called
&main.A{Name:""}
ele2 are called
var ele Aele2 := A{}
nil
var ele Aele2 := A{}