Short version
TEXT (*Hello).WorldAsm+0(SB),$0-16
./hello.s:1 syntax error, last name: TEXT
TEXT Hello.WorldAsm+0(SB),$0-16
./hello.s:1 syntax error, last name: .WorldAsm
TEXT Hello·WorldAsm+0(SB),$0-16
_/tmp/hello.TestWorld: undefined: _/tmp/hello.(*Hello).WorldAsm
TEXT hello·Hello·WorldAsm+0(SB),$0-16
_/tmp/hello.TestWorld: undefined: _/tmp/hello.(*Hello).WorldAsm
TEXT hello·(*Hello)·WorldAsm+0(SB),$0-16
./hello.s:1 syntax error, last name: hello.
TEXT hello·(Hello)·WorldAsm+0(SB),$0-16
./hello.s:1 syntax error, last name: Hello
TEXT hello·*Hello·WorldAsm+0(SB),$0-16
./hello.s:1 syntax error, last name: hello.
Long version:
$ cat hello.go
package hello
type Hello struct {
world int
}
func (h *Hello) World() int { return h.world }
$ go build -gcflags -S
# _/tmp/hello
--- prog list "(*Hello).World" ---
0000 (/tmp/hello/hello.go:7) TEXT (*Hello).World+0(SB),$0-16
0001 (/tmp/hello/hello.go:7) MOVQ h+0(FP),BX
0002 (/tmp/hello/hello.go:7) MOVQ (BX),BP
0003 (/tmp/hello/hello.go:7) MOVQ BP,.noname+8(FP)
0004 (/tmp/hello/hello.go:7) RET ,
$ echo "func(h *Hello) WorldAsm() int" >> hello.go
... typity type ..
$ cat hello_test.go
package hello
import "testing"
func TestWorld(t *testing.T) {
a := Hello{1337}
t.Log(a.World())
t.Log(a.WorldAsm())
}
$ cat hello.s
TEXT (*Hello).WorldAsm+0(SB),$0-16
MOVQ h+0(FP),BX
MOVQ (BX),BP
MOVQ BP,.noname+8(FP)
RET ,
$ go test
# _/tmp/hello
./hello.s:1 syntax error, last name: TEXT
FAIL _/tmp/hello [build failed]
$ sed s/\(\\*Hello\)/Hello/ hello.s > hello2.s && mv hello2.s hello.s && go test
# _/tmp/hello
./hello.s:1 syntax error, last name: .WorldAsm
FAIL _/tmp/hello [build failed]
$ sed s/.W/·W/ hello.s > hello2.s && mv hello2.s hello.s && go test
# testmain
_/tmp/hello.TestWorld: undefined: _/tmp/hello.(*Hello).WorldAsm
FAIL _/tmp/hello [build failed]
$ sed s/Hello/hello·Hello/ hello.s > hello2.s && mv hello2.s hello.s && go test
# testmain
_/tmp/hello.TestWorld: undefined: _/tmp/hello.(*Hello).WorldAsm
FAIL _/tmp/hello [build failed]
$ sed s/Hello/\(\\*Hello\)/ hello.s > hello2.s && mv hello2.s hello.s && go test
# _/tmp/hello
./hello.s:1 syntax error, last name: hello.
FAIL _/tmp/hello [build failed]
$ sed s/\\*// hello.s > hello2.s && mv hello2.s hello.s && go test
# _/tmp/hello
./hello.s:1 syntax error, last name: Hello
FAIL _/tmp/hello [build failed]
$ sed s/\(Hello\)/\\*Hello/ hello.s > hello2.s && mv hello2.s hello.s && go test
# _/tmp/hello
./hello.s:1 syntax error, last name: hello.
FAIL _/tmp/hello [build failed]