github.com/code-reading/golang@v0.0.0-20220303082512-ba5bc0e589a3/go/src/net/netgo_unix_test.go (about) 1 // Copyright 2013 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build (!cgo || netgo) && (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) 6 // +build !cgo netgo 7 // +build darwin dragonfly freebsd linux netbsd openbsd solaris 8 9 package net 10 11 import ( 12 "context" 13 "testing" 14 ) 15 16 func TestGoLookupIP(t *testing.T) { 17 defer dnsWaitGroup.Wait() 18 host := "localhost" 19 ctx := context.Background() 20 _, err, ok := cgoLookupIP(ctx, "ip", host) 21 if ok { 22 t.Errorf("cgoLookupIP must be a placeholder") 23 } 24 if err != nil { 25 t.Error(err) 26 } 27 if _, err := DefaultResolver.goLookupIP(ctx, "ip", host); err != nil { 28 t.Error(err) 29 } 30 }