Compare commits
5 Commits
85bac6b12b
...
main
Author | SHA1 | Date | |
---|---|---|---|
7b40ec37be | |||
86f0b6c785 | |||
95e06f326d | |||
0d9ce81ed3 | |||
0684576e40 |
@@ -1,14 +0,0 @@
|
||||
// boolean.go
|
||||
package bocchi
|
||||
|
||||
import "git.sunturtle.xyz/zephyr/errors-my-beloved/boolean/secret"
|
||||
|
||||
var _ = map[bool]struct{}{
|
||||
false: {},
|
||||
secret.Secret == "gc25{}": {}, // ERROR: ./boolean.go:7:2: duplicate key false in map literal
|
||||
}
|
||||
|
||||
var _ = map[bool]struct{}{
|
||||
false: {},
|
||||
secret.Secret[:5] != "gc25{": {}, // silently succeeds, even though it evaluates to false
|
||||
}
|
14
boolean/boolean_test.go
Normal file
14
boolean/boolean_test.go
Normal file
@@ -0,0 +1,14 @@
|
||||
// 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_test.go:7:2: duplicate key false in map literal
|
||||
}
|
||||
|
||||
var _ = map[bool]struct{}{
|
||||
false: {},
|
||||
challenge.Flag[13:] != "CRDy}": {}, // silently succeeds, even though it evaluates to false
|
||||
}
|
3
boolean/challenge/flag.go
Normal file
3
boolean/challenge/flag.go
Normal file
@@ -0,0 +1,3 @@
|
||||
package challenge
|
||||
|
||||
const Flag = "gc25{afR7yRQVCRDy}"
|
@@ -1,3 +0,0 @@
|
||||
package secret
|
||||
|
||||
const Secret = "gc25{afR7yRQVCRDy}"
|
7
constraint/cgo_is_required.go
Normal file
7
constraint/cgo_is_required.go
Normal file
@@ -0,0 +1,7 @@
|
||||
//go:build !cgo
|
||||
|
||||
package constraint
|
||||
|
||||
func _() {
|
||||
"This package requires cgo. An error here means cgo is disabled for your build."
|
||||
}
|
3
constraint/constraint.go
Normal file
3
constraint/constraint.go
Normal file
@@ -0,0 +1,3 @@
|
||||
//go:build cgo
|
||||
|
||||
package constraint
|
3
constraint/go.mod
Normal file
3
constraint/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module git.sunturtle.xyz/zephyr/errors-my-beloved/syntax
|
||||
|
||||
go 1.25.0
|
@@ -4,4 +4,4 @@ type Interface interface {
|
||||
Think(prefix []string) (string, error)
|
||||
}
|
||||
|
||||
func Think(s Interface, prompt string) (string, error) { panic("TODO") }
|
||||
func Think(br Interface, prompt string) (string, error) { panic("TODO") }
|
||||
|
@@ -1,6 +0,0 @@
|
||||
package brain
|
||||
|
||||
type (
|
||||
Message struct{}
|
||||
Tuple struct{}
|
||||
)
|
@@ -1,11 +0,0 @@
|
||||
package main
|
||||
|
||||
type Strummer interface {
|
||||
Strum()
|
||||
}
|
||||
|
||||
type Bocchi struct {
|
||||
Guitar string
|
||||
}
|
||||
|
||||
var _ Strummer = (*Bocchi)(nil)
|
3
iface/chord.go
Normal file
3
iface/chord.go
Normal file
@@ -0,0 +1,3 @@
|
||||
package main
|
||||
|
||||
type Chord string
|
13
iface/guitarist.go
Normal file
13
iface/guitarist.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package main
|
||||
|
||||
type Guitarist interface {
|
||||
Strum(chord Chord)
|
||||
}
|
||||
|
||||
type Bocchi struct {
|
||||
Guitar string
|
||||
}
|
||||
|
||||
func (b *Bocchi) Strum(chord string) {}
|
||||
|
||||
var _ Guitarist = (*Bocchi)(nil)
|
@@ -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() {}
|
||||
|
@@ -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() {}
|
||||
|
@@ -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() {}
|
||||
|
Reference in New Issue
Block a user