You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ pwd
/tmp/scratch
$ ls
main.go x_amd64.s x_other.go
$ cat main.go
package main
func main() {
println(foo())
}
$ cat x_amd64.s
TEXT ·foo(SB), 7, $0
MOVQ $43, ret+0(FP)
RET
$ cat x_other.go
package main
func foo() int { return 42 }
Note that foo has two bodies defined: one returns 42, the other returns 43. Surely this should be a compile or asm or link error, yet "go build" seems happy:
$ vim x_other.go
$ cat x_other.go
package main
func foo() int { return 42 }
$ go vet
: x_amd64.s:1: [amd64] foo: function foo missing Go declaration
exit status 1
The text was updated successfully, but these errors were encountered:
Why 7 here? That's NOSPLIT + DUPOK + NOPROF. It's probably still a bug that this fails, but the presence of DUPOK here makes it a bit less surprising :-)
Note that foo has two bodies defined: one returns 42, the other returns 43. Surely this should be a compile or asm or link error, yet "go build" seems happy:
Changing the
to be
in x_other.go now has "go build" picking up the other definition:
Still, something ain't right. Re-inserting that
into the x_other.go file gives:
The text was updated successfully, but these errors were encountered: