1
0
mirror of https://github.com/golang/go synced 2024-11-18 00:54:45 -07:00

net: adjust build tags for darwin libc calls

Support for direct libc calls was added in CL 446178 but the build
tags weren't quite activating it when cgo was not enabled. Adjust them
and add a new supporting file for darwin.

This should use the new direct libc calls with both CGO_ENABLED=0 and
CGO_ENABLED=1 when building for darwin.

Updates #12524

Change-Id: Ieee4b298dee13f389ed3a63c0a4a3a18c9180163
Reviewed-on: https://go-review.googlesource.com/c/go/+/448020
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Dan Peterson <danp@danp.net>
Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Dan Peterson 2022-11-06 17:03:00 -04:00 committed by Gopher Robot
parent 969bea8d59
commit e7422b0591
8 changed files with 17 additions and 8 deletions

View File

@ -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

9
src/net/cgo_darwin.go Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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