Skip to content

Commit

Permalink
define stub type and methods for vet
Browse files Browse the repository at this point in the history
Signed-off-by: grant <[email protected]>
  • Loading branch information
grantseltzer committed Apr 1, 2019
1 parent a9ccfe8 commit a9ff324
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/net/cgo_darwin_stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ import (
"golang.org/x/net/dns/dnsmessage"
)

type addrinfoErrno int

func (eai addrinfoErrno) Error() string { return "<nil>" }
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 {
Expand Down Expand Up @@ -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[:])
Expand Down

0 comments on commit a9ff324

Please sign in to comment.