Skip to content

Commit c863c3b

Browse files
committed
Rename RunOrPanic and BootOrPanic to MustRun and MustBoot
Must prefix is an idiomatic Go - for example regexp package has the MustCompile function. Many 3rd party libraries use similar convention. Additionally, MustRun has lower number of characters than RunOrPanic (which is usually good for public functions).
1 parent 627c46b commit c863c3b

File tree

18 files changed

+93
-92
lines changed

18 files changed

+93
-92
lines changed

examples/boot/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ func main() {
1111
pi.ScreenHeight = 44
1212

1313
// boot the game with custom screen resolution:
14-
pi.BootOrPanic()
14+
pi.MustBoot()
1515

1616
// once boot is executed all drawing functions are available:
1717
pi.Cursor(0, 18)
1818
pi.Print("TINY SCREEN", 7) // print text on the screen before game loop
1919

2020
// Run the game loop.
21-
pi.RunOrPanic()
21+
pi.MustRun()
2222
// Update and Draw functions were not set therefore screen will be fixed.
2323
}

examples/controller/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func main() {
3434
drawPlayerController(2, 67, 20)
3535
drawPlayerController(3, 67, 70)
3636
}
37-
pi.RunOrPanic()
37+
pi.MustRun()
3838
}
3939

4040
func drawPlayerController(player, x, y int) {

examples/hello/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ func main() {
2424
pi.Spr(i, x, 60+int(y))
2525
}
2626
}
27-
pi.RunOrPanic()
27+
pi.MustRun()
2828
}

examples/memory/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ func main() {
1616
}
1717
}
1818

19-
pi.RunOrPanic()
19+
pi.MustRun()
2020
}

examples/pal/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ func draw() {
5858
func main() {
5959
pi.Resources = resources
6060
pi.Draw = draw
61-
pi.RunOrPanic()
61+
pi.MustRun()
6262
}

examples/print/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ func main() {
1212
pi.Print("HELLO,", 9) // print yellow text and go to next line
1313
pi.Print("GOPHER!", 12)
1414
}
15-
pi.RunOrPanic()
15+
pi.MustRun()
1616
}

examples/shapes/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func main() {
8989
drawMousePointer()
9090
}
9191

92-
pi.RunOrPanic()
92+
pi.MustRun()
9393
}
9494

9595
func drawMousePointer() {

examples/trigonometry/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func main() {
2020
draw(96, 11, pi.Cos)
2121

2222
}
23-
pi.RunOrPanic()
23+
pi.MustRun()
2424
}
2525

2626
func draw(line int, color byte, f func(x float64) float64) {

internal/bench/screen_bench_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func runBenchmarks(b *testing.B, callback func(res Resolution)) {
139139
b.Run(resolution.String(), func(b *testing.B) {
140140
pi.ScreenWidth = resolution.W
141141
pi.ScreenHeight = resolution.H
142-
pi.BootOrPanic()
142+
pi.MustBoot()
143143

144144
b.ReportAllocs()
145145
b.ResetTimer()

internal/fuzz/print_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
func FuzzPrint(f *testing.F) {
1515
pi.ScreenWidth = 16
1616
pi.ScreenHeight = 24
17-
pi.BootOrPanic()
17+
pi.MustBoot()
1818
f.Fuzz(func(t *testing.T, x, y int) {
1919
pi.Cursor(x, y)
2020
pi.Print("A", color)

0 commit comments

Comments
 (0)