diff --git a/src/net/cgo_bsd.go b/src/net/cgo_bsd.go index 1456289b0691b..082e91faa8afb 100644 --- a/src/net/cgo_bsd.go +++ b/src/net/cgo_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build cgo && !netgo && (darwin || dragonfly || freebsd) +//go:build cgo && !netgo && (dragonfly || freebsd) package net diff --git a/src/net/cgo_darwin.go b/src/net/cgo_darwin.go new file mode 100644 index 0000000000000..129dd937fe077 --- /dev/null +++ b/src/net/cgo_darwin.go @@ -0,0 +1,9 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package net + +import "internal/syscall/unix" + +const cgoAddrInfoFlags = (unix.AI_CANONNAME | unix.AI_V4MAPPED | unix.AI_ALL) & unix.AI_MASK diff --git a/src/net/cgo_stub.go b/src/net/cgo_stub.go index 298d829f6fa6d..c901d4bb80abd 100644 --- a/src/net/cgo_stub.go +++ b/src/net/cgo_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !cgo || netgo +//go:build (!cgo && !darwin) || netgo package net diff --git a/src/net/cgo_unix.go b/src/net/cgo_unix.go index a94472733815f..4ca0fbee73ea2 100644 --- a/src/net/cgo_unix.go +++ b/src/net/cgo_unix.go @@ -7,7 +7,7 @@ // Instead of C.foo it uses _C_foo, which is defined in either // cgo_unix_cgo.go or cgo_unix_syscall.go -//go:build cgo && !netgo && unix +//go:build !netgo && ((cgo && unix) || darwin) package net diff --git a/src/net/cgo_unix_syscall.go b/src/net/cgo_unix_syscall.go index 7170f14c466bd..c5c27967b1350 100644 --- a/src/net/cgo_unix_syscall.go +++ b/src/net/cgo_unix_syscall.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build cgo && !netgo && darwin +//go:build !netgo && darwin package net diff --git a/src/net/cgo_unix_test.go b/src/net/cgo_unix_test.go index af9f9dc3f2c8f..86726dd7e5c70 100644 --- a/src/net/cgo_unix_test.go +++ b/src/net/cgo_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build cgo && !netgo && unix +//go:build (cgo || darwin) && !netgo && unix package net diff --git a/src/net/netgo.go b/src/net/netgo.go index 75baa880354c5..e478c88b30358 100644 --- a/src/net/netgo.go +++ b/src/net/netgo.go @@ -4,9 +4,9 @@ // Default netGo to true if the netgo build tag is being used, or the // C library DNS routines are not available. Note that the C library -// routines are always available on Windows. +// routines are always available on Darwin and Windows. -//go:build netgo || (!cgo && !windows) +//go:build netgo || (!cgo && !darwin && !windows) package net diff --git a/src/net/netgo_unix_test.go b/src/net/netgo_unix_test.go index 019772aa6aaab..5ddebab143759 100644 --- a/src/net/netgo_unix_test.go +++ b/src/net/netgo_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build (!cgo || netgo) && (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) +//go:build (!cgo || netgo) && (dragonfly || freebsd || linux || netbsd || openbsd || solaris) package net