aboutsummaryrefslogtreecommitdiff
path: root/src/net/internal/cgotest/resstate.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2023-12-12 12:53:32 -0500
committerGopher Robot <gobot@golang.org>2024-01-23 18:09:52 +0000
commit4085a4893c427a2138e28fe4f16a646e7f571adb (patch)
treeb9593a44258aae216c874e4d19020519b5cbc9e2 /src/net/internal/cgotest/resstate.go
parent76b8bec6dbea9d56edbb5b2e8ab2fcf100ac1cd0 (diff)
downloadgo-4085a4893c427a2138e28fe4f16a646e7f571adb.tar.xz
net: move cgo-using darwin test to separate package
It is a goal / requirement that nothing in the standard library on darwin require cgo, and this test-only file makes net use cgo on darwin. Move it elsewhere. Change-Id: I6c11a8391d3913f73ce0098ba63b29adf5864f93 Reviewed-on: https://go-review.googlesource.com/c/go/+/549255 Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/net/internal/cgotest/resstate.go')
-rw-r--r--src/net/internal/cgotest/resstate.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/net/internal/cgotest/resstate.go b/src/net/internal/cgotest/resstate.go
new file mode 100644
index 0000000000..1b4871109e
--- /dev/null
+++ b/src/net/internal/cgotest/resstate.go
@@ -0,0 +1,21 @@
+// Copyright 2023 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.
+
+//go:build cgo && darwin
+
+package cgotest
+
+/*
+#include <resolv.h>
+*/
+import "C"
+
+import (
+ "internal/syscall/unix"
+ "unsafe"
+)
+
+// This will cause a compile error when the size of
+// unix.ResState is too small.
+type _ [unsafe.Sizeof(unix.ResState{}) - unsafe.Sizeof(C.struct___res_state{})]byte