Please answer these questions before submitting your issue. Thanks!
### What …version of Go are you using (`go version`)?
go version go1.6.2 linux/amd64
### What operating system and processor architecture are you using (`go env`)?
```bash
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/go-1.6"
GOTOOLDIR="/usr/lib/go-1.6/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"
```
### What did you do?
I have `get-ip.go` with this code:
```go
package main
import (
"fmt"
"net"
)
func main() {
addr, err := net.LookupHost("storage.googleapis.com")
fmt.Println(addr, err)
}
```
### What did you expect to see?
```bash
# ./get-ip
[216.58.201.112 2a00:1450:4014:801::2010] <nil>
```
### What did you see instead?
```bash
# ./get-ip
dial tcp: lookup storage.googleapis.com on 10.36.1.10:53: cannot unmarshal DNS message
```
### Additional information:
It works with `GODEBUG=netdns=cgo`, but not with `GODEBUG=netdns=go`
```bash
# GODEBUG=netdns=cgo ./get-ip
[172.217.23.208 2a00:1450:4014:80c::2010] <nil>
```
```bash
# GODEBUG=netdns=go ./get-ip
dial tcp: lookup storage.googleapis.com on 10.36.1.10:53: cannot unmarshal DNS message
```
**It also started working after flushing dns-cache on my dns-server.**
So I made capture of answer from dns-server:
**before**: (got error)
```
Domain Name System (response)
[Request In: 2]
[Time: 0.000410000 seconds]
Transaction ID: 0xc4c9
Flags: 0x8180 Standard query response, No error
Questions: 1
Answer RRs: 2
Authority RRs: 13
Additional RRs: 14
Queries
storage.googleapis.com: type AAAA, class IN
Answers
storage.googleapis.com: type CNAME, class IN, cname storage.l.googleusercontent.com
storage.l.googleusercontent.com: type AAAA, class IN, addr 2a00:1450:4014:80d::2010
Authoritative nameservers
com: type NS, class IN, ns h.gtld-servers.net
com: type NS, class IN, ns c.gtld-servers.net
com: type NS, class IN, ns k.gtld-servers.net
com: type NS, class IN, ns b.gtld-servers.net
com: type NS, class IN, ns d.gtld-servers.net
com: type NS, class IN, ns f.gtld-servers.net
com: type NS, class IN, ns g.gtld-servers.net
com: type NS, class IN, ns m.gtld-servers.net
com: type NS, class IN, ns i.gtld-servers.net
com: type NS, class IN, ns j.gtld-servers.net
com: type NS, class IN, ns e.gtld-servers.net
com: type NS, class IN, ns l.gtld-servers.net
com: type NS, class IN, ns a.gtld-servers.net
Additional records
storage.l.googleusercontent.com: type A, class IN, addr 216.58.201.112
h.gtld-servers.net: type A, class IN, addr 192.54.112.30
c.gtld-servers.net: type A, class IN, addr 192.26.92.30
k.gtld-servers.net: type A, class IN, addr 192.52.178.30
b.gtld-servers.net: type A, class IN, addr 192.33.14.30
d.gtld-servers.net: type A, class IN, addr 192.31.80.30
f.gtld-servers.net: type A, class IN, addr 192.35.51.30
g.gtld-servers.net: type A, class IN, addr 192.42.93.30
m.gtld-servers.net: type A, class IN, addr 192.55.83.30
i.gtld-servers.net: type A, class IN, addr 192.43.172.30
j.gtld-servers.net: type A, class IN, addr 192.48.79.30
e.gtld-servers.net: type A, class IN, addr 192.12.94.30
l.gtld-servers.net: type A, class IN, addr 192.41.162.30
a.gtld-servers.net: type A, class IN, addr 192.5.6.30
```
**after:** (is working)
```
Domain Name System (response)
[Request In: 1]
[Time: 0.000746000 seconds]
Transaction ID: 0x86fe
Flags: 0x8180 Standard query response, No error
Questions: 1
Answer RRs: 2
Authority RRs: 0
Additional RRs: 0
Queries
storage.googleapis.com: type A, class IN
Answers
storage.googleapis.com: type CNAME, class IN, cname storage.l.googleusercontent.com
storage.l.googleusercontent.com: type A, class IN, addr 216.58.201.112
```
And hexdump of package:
**before**: (got error)
```
0000 86 ea 80 1a 4b c3 9a cc 60 09 5f 0b 08 00 45 00 ....K...`._...E.
0010 02 2e 05 b1 00 00 40 11 5c 59 0a 24 01 0a 0a 24 ......@.\Y.$...$
0020 01 64 00 35 b2 cc 02 1a 18 e1 82 0a 81 80 00 01 .d.5............
0030 00 02 00 0d 00 0d 07 73 74 6f 72 61 67 65 0a 67 .......storage.g
0040 6f 6f 67 6c 65 61 70 69 73 03 63 6f 6d 00 00 01 oogleapis.com...
0050 00 01 c0 0c 00 05 00 01 00 00 0a af 00 1e 07 73 ...............s
0060 74 6f 72 61 67 65 01 6c 11 67 6f 6f 67 6c 65 75 torage.l.googleu
0070 73 65 72 63 6f 6e 74 65 6e 74 c0 1f c0 34 00 01 sercontent...4..
0080 00 01 00 00 00 63 00 04 d8 3a c9 70 c0 1f 00 02 .....c...:.p....
0090 00 01 00 01 52 3a 00 14 01 61 0c 67 74 6c 64 2d ....R:...a.gtld-
00a0 73 65 72 76 65 72 73 03 6e 65 74 00 c0 1f 00 02 servers.net.....
00b0 00 01 00 01 52 3a 00 04 01 68 c0 70 c0 1f 00 02 ....R:...h.p....
00c0 00 01 00 01 52 3a 00 04 01 63 c0 70 c0 1f 00 02 ....R:...c.p....
00d0 00 01 00 01 52 3a 00 04 01 6b c0 70 c0 1f 00 02 ....R:...k.p....
00e0 00 01 00 01 52 3a 00 04 01 62 c0 70 c0 1f 00 02 ....R:...b.p....
00f0 00 01 00 01 52 3a 00 04 01 64 c0 70 c0 1f 00 02 ....R:...d.p....
0100 00 01 00 01 52 3a 00 04 01 66 c0 70 c0 1f 00 02 ....R:...f.p....
0110 00 01 00 01 52 3a 00 04 01 67 c0 70 c0 1f 00 02 ....R:...g.p....
0120 00 01 00 01 52 3a 00 04 01 6d c0 70 c0 1f 00 02 ....R:...m.p....
0130 00 01 00 01 52 3a 00 04 01 69 c0 70 c0 1f 00 02 ....R:...i.p....
0140 00 01 00 01 52 3a 00 04 01 6a c0 70 c0 1f 00 02 ....R:...j.p....
0150 00 01 00 01 52 3a 00 04 01 65 c0 70 c0 1f 00 02 ....R:...e.p....
0160 00 01 00 01 52 3a 00 04 01 6c c0 70 c0 6e 00 01 ....R:...l.p.n..
0170 00 01 00 00 ca ea 00 04 c0 05 06 1e c0 8e 00 01 ................
0180 00 01 00 00 ca ea 00 04 c0 36 70 1e c0 9e 00 01 .........6p.....
0190 00 01 00 00 ca ea 00 04 c0 1a 5c 1e c0 ae 00 01 ..........\.....
01a0 00 01 00 00 ca ea 00 04 c0 34 b2 1e c0 be 00 01 .........4......
01b0 00 01 00 00 ca ea 00 04 c0 21 0e 1e c0 ce 00 01 .........!......
01c0 00 01 00 00 ca ea 00 04 c0 1f 50 1e c0 de 00 01 ..........P.....
01d0 00 01 00 00 ca ea 00 04 c0 23 33 1e c0 ee 00 01 .........#3.....
01e0 00 01 00 00 ca ea 00 04 c0 2a 5d 1e c0 fe 00 01 .........*].....
01f0 00 01 00 00 ca ea 00 04 c0 37 53 1e c1 0e 00 01 .........7S.....
0200 00 01 00 00 ca ea 00 04 c0 2b ac 1e c1 1e 00 01 .........+......
0210 00 01 00 00 ca ea 00 04 c0 30 4f 1e c1 2e 00 01 .........0O.....
0220 00 01 00 00 ca ea 00 04 c0 0c 5e 1e c1 3e 00 01 ..........^..>..
0230 00 01 00 00 ca ea 00 04 c0 29 a2 1e .........)..
```
**after:** (is working)
```
0000 86 ea 80 1a 4b c3 9a cc 60 09 5f 0b 08 00 45 00 ....K...`._...E.
0010 00 7e 07 00 00 00 40 11 5c ba 0a 24 01 0a 0a 24 .~....@.\..$...$
0020 01 64 00 35 93 32 00 6a 17 31 86 fe 81 80 00 01 .d.5.2.j.1......
0030 00 02 00 00 00 00 07 73 74 6f 72 61 67 65 0a 67 .......storage.g
0040 6f 6f 67 6c 65 61 70 69 73 03 63 6f 6d 00 00 01 oogleapis.com...
0050 00 01 c0 0c 00 05 00 01 00 00 0a 40 00 1e 07 73 ...........@...s
0060 74 6f 72 61 67 65 01 6c 11 67 6f 6f 67 6c 65 75 torage.l.googleu
0070 73 65 72 63 6f 6e 74 65 6e 74 c0 1f c0 34 00 01 sercontent...4..
0080 00 01 00 00 00 26 00 04 d8 3a c9 70 .....&...:.p
```
I presume that it connected with:
- https://github.com/golang/go/issues/11070
- https://stackoverflow.com/questions/38770700