From a9ff324b8d7049ea2f153121f8d3b845a1772e31 Mon Sep 17 00:00:00 2001 From: grant Date: Mon, 1 Apr 2019 17:15:53 -0400 Subject: [PATCH] define stub type and methods for vet Signed-off-by: grant --- src/net/cgo_darwin_stub.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/net/cgo_darwin_stub.go b/src/net/cgo_darwin_stub.go index 550f8accabfa48..1a50042f857fd0 100644 --- a/src/net/cgo_darwin_stub.go +++ b/src/net/cgo_darwin_stub.go @@ -15,6 +15,12 @@ import ( "golang.org/x/net/dns/dnsmessage" ) +type addrinfoErrno int + +func (eai addrinfoErrno) Error() string { return "" } +func (eai addrinfoErrno) Temporary() bool { return false } +func (eai addrinfoErrno) Timeout() bool { return false } + func cgoLookupHost(ctx context.Context, name string) (addrs []string, err error, completed bool) { resources, err := resolverGetResources(ctx, name, int32(dnsmessage.TypeALL), int32(dnsmessage.ClassINET)) if err != nil { @@ -103,6 +109,9 @@ func resolverGetResources(ctx context.Context, hostname string, rtype, class int if errCode != 0 { return nil, errors.New("could not complete domain resolution return code " + string(errCode)) } + if size == 0 { + return nil, errors.New("received empty response") + } var msg dnsmessage.Message err := msg.Unpack(responseBuffer[:])