<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ 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 }"><pre class="notranslate"><code class="notranslate">$ 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 }
</code></pre></div>
<p dir="auto">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:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ go build -x &amp;&amp; ./scratch &amp;&amp; rm ./scratch 
WORK=/tmp/go-build115513716
mkdir -p $WORK/_/tmp/scratch/_obj/
mkdir -p $WORK/_/tmp/scratch/_obj/exe/
cd /tmp/scratch
/home/nt/go/pkg/tool/linux_amd64/compile -o $WORK/_/tmp/scratch.a -trimpath $WORK -p main -buildid acfccd74ae478f8fecc64195dd5e90e7757cec11 -D _/tmp/scratch -I $WORK -pack -asmhdr $WORK/_/tmp/scratch/_obj/go_asm.h ./main.go ./x_other.go
/home/nt/go/pkg/tool/linux_amd64/asm -o $WORK/_/tmp/scratch/_obj/x_amd64.o -trimpath $WORK -I $WORK/_/tmp/scratch/_obj/ -I /home/nt/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./x_amd64.s
pack r $WORK/_/tmp/scratch.a $WORK/_/tmp/scratch/_obj/x_amd64.o # internal
cd .
/home/nt/go/pkg/tool/linux_amd64/link -o $WORK/_/tmp/scratch/_obj/exe/a.out -L $WORK -extld=gcc -buildmode=exe -buildid=acfccd74ae478f8fecc64195dd5e90e7757cec11 $WORK/_/tmp/scratch.a
mv $WORK/_/tmp/scratch/_obj/exe/a.out scratch
42"><pre class="notranslate"><code class="notranslate">$ go build -x &amp;&amp; ./scratch &amp;&amp; rm ./scratch 
WORK=/tmp/go-build115513716
mkdir -p $WORK/_/tmp/scratch/_obj/
mkdir -p $WORK/_/tmp/scratch/_obj/exe/
cd /tmp/scratch
/home/nt/go/pkg/tool/linux_amd64/compile -o $WORK/_/tmp/scratch.a -trimpath $WORK -p main -buildid acfccd74ae478f8fecc64195dd5e90e7757cec11 -D _/tmp/scratch -I $WORK -pack -asmhdr $WORK/_/tmp/scratch/_obj/go_asm.h ./main.go ./x_other.go
/home/nt/go/pkg/tool/linux_amd64/asm -o $WORK/_/tmp/scratch/_obj/x_amd64.o -trimpath $WORK -I $WORK/_/tmp/scratch/_obj/ -I /home/nt/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./x_amd64.s
pack r $WORK/_/tmp/scratch.a $WORK/_/tmp/scratch/_obj/x_amd64.o # internal
cd .
/home/nt/go/pkg/tool/linux_amd64/link -o $WORK/_/tmp/scratch/_obj/exe/a.out -L $WORK -extld=gcc -buildmode=exe -buildid=acfccd74ae478f8fecc64195dd5e90e7757cec11 $WORK/_/tmp/scratch.a
mv $WORK/_/tmp/scratch/_obj/exe/a.out scratch
42
</code></pre></div>
<p dir="auto">Changing the</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="func foo() int { return 42 }"><pre class="notranslate"><code class="notranslate">func foo() int { return 42 }
</code></pre></div>
<p dir="auto">to be</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="func foo() int"><pre class="notranslate"><code class="notranslate">func foo() int
</code></pre></div>
<p dir="auto">in x_other.go now has "go build" picking up the other definition:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ vim x_other.go 
$ cat x_other.go 
package main

func foo() int
$ go build -x &amp;&amp; ./scratch &amp;&amp; rm ./scratch 
WORK=/tmp/go-build732255335
mkdir -p $WORK/_/tmp/scratch/_obj/
mkdir -p $WORK/_/tmp/scratch/_obj/exe/
cd /tmp/scratch
/home/nt/go/pkg/tool/linux_amd64/compile -o $WORK/_/tmp/scratch.a -trimpath $WORK -p main -buildid acfccd74ae478f8fecc64195dd5e90e7757cec11 -D _/tmp/scratch -I $WORK -pack -asmhdr $WORK/_/tmp/scratch/_obj/go_asm.h ./main.go ./x_other.go
/home/nt/go/pkg/tool/linux_amd64/asm -o $WORK/_/tmp/scratch/_obj/x_amd64.o -trimpath $WORK -I $WORK/_/tmp/scratch/_obj/ -I /home/nt/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./x_amd64.s
pack r $WORK/_/tmp/scratch.a $WORK/_/tmp/scratch/_obj/x_amd64.o # internal
cd .
/home/nt/go/pkg/tool/linux_amd64/link -o $WORK/_/tmp/scratch/_obj/exe/a.out -L $WORK -extld=gcc -buildmode=exe -buildid=acfccd74ae478f8fecc64195dd5e90e7757cec11 $WORK/_/tmp/scratch.a
mv $WORK/_/tmp/scratch/_obj/exe/a.out scratch
43"><pre class="notranslate"><code class="notranslate">$ vim x_other.go 
$ cat x_other.go 
package main

func foo() int
$ go build -x &amp;&amp; ./scratch &amp;&amp; rm ./scratch 
WORK=/tmp/go-build732255335
mkdir -p $WORK/_/tmp/scratch/_obj/
mkdir -p $WORK/_/tmp/scratch/_obj/exe/
cd /tmp/scratch
/home/nt/go/pkg/tool/linux_amd64/compile -o $WORK/_/tmp/scratch.a -trimpath $WORK -p main -buildid acfccd74ae478f8fecc64195dd5e90e7757cec11 -D _/tmp/scratch -I $WORK -pack -asmhdr $WORK/_/tmp/scratch/_obj/go_asm.h ./main.go ./x_other.go
/home/nt/go/pkg/tool/linux_amd64/asm -o $WORK/_/tmp/scratch/_obj/x_amd64.o -trimpath $WORK -I $WORK/_/tmp/scratch/_obj/ -I /home/nt/go/pkg/include -D GOOS_linux -D GOARCH_amd64 ./x_amd64.s
pack r $WORK/_/tmp/scratch.a $WORK/_/tmp/scratch/_obj/x_amd64.o # internal
cd .
/home/nt/go/pkg/tool/linux_amd64/link -o $WORK/_/tmp/scratch/_obj/exe/a.out -L $WORK -extld=gcc -buildmode=exe -buildid=acfccd74ae478f8fecc64195dd5e90e7757cec11 $WORK/_/tmp/scratch.a
mv $WORK/_/tmp/scratch/_obj/exe/a.out scratch
43
</code></pre></div>
<p dir="auto">Still, something ain't right. Re-inserting that</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{ return 42 }"><pre class="notranslate"><code class="notranslate">{ return 42 }
</code></pre></div>
<p dir="auto">into the x_other.go file gives:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ 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"><pre class="notranslate"><code class="notranslate">$ 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
</code></pre></div>
<p dir="auto">Please answer these questions before submitting your issue. Thanks!</p>
<ol dir="auto">
<li>What version of Go are you using (<code class="notranslate">go version</code>)?</li>
</ol>
<p dir="auto">go version devel +beabd87 Tue Mar 8 06:02:15 2016 +0000 freebsd/amd64</p>
<ol dir="auto">
<li>What operating system and processor architecture are you using (<code class="notranslate">go env</code>)?</li>
</ol>
<pre class="notranslate">GOARCH="amd64"
GOBIN="/home/rhinofly/home/ds/sandspace/go/bin.freebsd-amd64"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOOS="freebsd"
GOPATH="/home/rhinofly/home/ds/sandspace/external/:/home/rhinofly/home/ds/sandspace/golibs/"
GORACE=""
GOROOT="/home/rhinofly/home/ds/sandspace/go"
GOTOOLDIR="/home/rhinofly/home/ds/sandspace/go/pkg/tool/freebsd_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -gno-record-gcc-switches"
CXX="clang++"
CGO_ENABLED="1"
</pre>
<pre class="notranslate">$ ifconfig -a
em0: flags=8843 metric 0 mtu 1500
    options=209b
    ether 66:30:38:38:64:30
    inet 10.236.12.201 netmask 0xffffff00 broadcast 10.236.12.255 
    nd6 options=29
    media: Ethernet autoselect (1000baseT )
    status: active
lo0: flags=8049 metric 0 mtu 16384
    options=600003
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 
    inet 127.0.0.1 netmask 0xff000000 
    nd6 options=21
    groups: lo 
</pre>
<pre class="notranslate">$ uname -a
FreeBSD rhinofly-devel-800201.localdomain 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r295683: Wed Feb 17 02:07:17 UTC 2016     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
</pre>
<ol dir="auto">
<li>What did you do?<br>
(Use play.golang.org to provide a runnable example, if possible.)</li>
</ol>
<p dir="auto">git clone <a href="https://github.com/golang/go.git">https://github.com/golang/go.git</a> tips-go &amp;&amp; cd tips-go/src &amp;&amp; ./all.bash</p>
<ol dir="auto">
<li>What did you expect to see?</li>
</ol>
<p dir="auto">build done without error and warning.</p>
<ol dir="auto">
<li>What did you see instead?
<pre class="notranslate">--- FAIL: TestInterfaces (0.00s)
interface_test.go:74: route ip+net: invalid network interface name
FAIL
FAIL    net 2.240s
</pre>
</li>
</ol>
<p dir="auto">detail data by fmt.Printf(%v):</p>
<pre class="notranslate">all interfaces data:
ift=[{1 1500  dc:05:00:00:00:00:00:00:00:ca:9a:3b:00:00:00:00:94:49:13:00:00:00:00:00:00:00:00:00:00:00:00:00:1f:61:0a:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:44:63:57:67:00:00:00:00:08:dc:76:04:00:00:00:00:18:1f:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:06:00:00:00:00:00:00:00:01:00:00:00:00:00:00:00:6b:f0:dc:56:00:00:00:00:3f:f6:05:00:00:00:00:00:38:12:01:00:06:03:06:00 up|broadcast|multicast} {2 16384  00:40:00:00:00:00:00:00:00:00:00:00:00:00:00:00:9d:ac:01:00:00:00:00:00:00:00:00:00:00:00:00:00:9d:ac:01:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:2b:d2:32:0c:00:00:00:00:2b:d2:32:0c:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:0f:0e:00:00:00:00:00:00:01:00:00:00:00:00:00:00:6a:f0:dc:56:00:00:00:00:5d:8e:08:00:00:00:00:00:38:12:02:00:18:03:00:00 up|loopback|multicast}]

test failed:
ifi={1 1500  dc:05:00:00:00:00:00:00:00:ca:9a:3b:00:00:00:00:94:49:13:00:00:00:00:00:00:00:00:00:00:00:00:00:1f:61:0a:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:44:63:57:67:00:00:00:00:08:dc:76:04:00:00:00:00:18:1f:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:06:00:00:00:00:00:00:00:01:00:00:00:00:00:00:00:6b:f0:dc:56:00:00:00:00:3f:f6:05:00:00:00:00:00:38:12:01:00:06:03:06:00 up|broadcast|multicast}, ifxn-, err=route ip+net: invalid network interface name
</pre>