From 86f0b6c7854076ba904aa1c18e9becd01bb99518 Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Wed, 27 Aug 2025 22:49:18 -0400 Subject: [PATCH] boolean, sizeofstring: update after talking with x/tools folks --- boolean/{boolean.go => boolean_test.go} | 6 +++--- constraint/cgo_is_required.go | 2 +- sizeofstring/step1.go | 4 +++- sizeofstring/step2.go | 4 +++- sizeofstring/step3.go | 4 +++- 5 files changed, 13 insertions(+), 7 deletions(-) rename boolean/{boolean.go => boolean_test.go} (67%) diff --git a/boolean/boolean.go b/boolean/boolean_test.go similarity index 67% rename from boolean/boolean.go rename to boolean/boolean_test.go index eeba325..f999299 100644 --- a/boolean/boolean.go +++ b/boolean/boolean_test.go @@ -1,11 +1,11 @@ -// boolean.go -package bocchi +// boolean_test.go +package bocchi_test import "git.sunturtle.xyz/zephyr/errors-my-beloved/boolean/challenge" var _ = map[bool]struct{}{ false: {}, - challenge.Flag == "gc25{}": {}, // ERROR: ./boolean.go:7:2: duplicate key false in map literal + challenge.Flag == "gc25{}": {}, // ERROR: ./boolean_test.go:7:2: duplicate key false in map literal } var _ = map[bool]struct{}{ diff --git a/constraint/cgo_is_required.go b/constraint/cgo_is_required.go index 900e837..a1fb98f 100644 --- a/constraint/cgo_is_required.go +++ b/constraint/cgo_is_required.go @@ -3,5 +3,5 @@ package constraint func _() { - "This package requires cgo to build. An error here means cgo is disabled for your build." + "This package requires cgo. An error here means cgo is disabled for your build." } diff --git a/sizeofstring/step1.go b/sizeofstring/step1.go index efbb4c6..6ef52a1 100644 --- a/sizeofstring/step1.go +++ b/sizeofstring/step1.go @@ -1,7 +1,7 @@ //go:build ignore // step1.go -package bocchi +package main import "unsafe" @@ -11,3 +11,5 @@ type Bocchi struct { } var _ [0]struct{} = [unsafe.Sizeof(Bocchi{}) - 0]struct{}{} + +func main() {} diff --git a/sizeofstring/step2.go b/sizeofstring/step2.go index c78caaa..61a85be 100644 --- a/sizeofstring/step2.go +++ b/sizeofstring/step2.go @@ -1,7 +1,7 @@ //go:build ignore // step2.go -package bocchi +package main import "unsafe" @@ -11,3 +11,5 @@ type Bocchi struct { } var _ [0]struct{} = [unsafe.Sizeof(Bocchi{}) - 16]struct{}{} + +func main() {} diff --git a/sizeofstring/step3.go b/sizeofstring/step3.go index caefc5b..0b12315 100644 --- a/sizeofstring/step3.go +++ b/sizeofstring/step3.go @@ -1,4 +1,4 @@ -package bocchi +package main import "unsafe" @@ -16,3 +16,5 @@ var ( // assert y is the last field in Bocchi _ [0]struct{} = [unsafe.Sizeof(Bocchi{}) - (unsafe.Alignof(Bocchi{}.y) + unsafe.Sizeof(Bocchi{}.y))]struct{}{} ) + +func main() {}