From 95e06f326d7e4da274b2d69ab08a033d600e16fc Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Wed, 27 Aug 2025 15:54:23 -0400 Subject: [PATCH] constraint: example of forcing an error for impossible builds --- constraint/cgo_is_required.go | 7 +++++++ constraint/constraint.go | 3 +++ constraint/go.mod | 3 +++ go.work | 1 + 4 files changed, 14 insertions(+) create mode 100644 constraint/cgo_is_required.go create mode 100644 constraint/constraint.go create mode 100644 constraint/go.mod diff --git a/constraint/cgo_is_required.go b/constraint/cgo_is_required.go new file mode 100644 index 0000000..900e837 --- /dev/null +++ b/constraint/cgo_is_required.go @@ -0,0 +1,7 @@ +//go:build !cgo + +package constraint + +func _() { + "This package requires cgo to build. An error here means cgo is disabled for your build." +} diff --git a/constraint/constraint.go b/constraint/constraint.go new file mode 100644 index 0000000..a3798fd --- /dev/null +++ b/constraint/constraint.go @@ -0,0 +1,3 @@ +//go:build cgo + +package constraint diff --git a/constraint/go.mod b/constraint/go.mod new file mode 100644 index 0000000..6f718ba --- /dev/null +++ b/constraint/go.mod @@ -0,0 +1,3 @@ +module git.sunturtle.xyz/zephyr/errors-my-beloved/syntax + +go 1.25.0 diff --git a/go.work b/go.work index ec057f8..098806f 100644 --- a/go.work +++ b/go.work @@ -7,4 +7,5 @@ use ( ./iface ./sizeofstring ./stringer + ./constraint )