style: go vet applied
This commit is contained in:
@@ -68,6 +68,7 @@ func game(initrandom bool) {
|
||||
// catch interrupt signals
|
||||
sigs := make(chan os.Signal, 1)
|
||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
|
||||
defer signal.Stop(sigs)
|
||||
|
||||
// initialize screen
|
||||
term.StartFullscreen()
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ func (a *Arena) processChunk(to *Arena, startY, endY int) {
|
||||
yCurrOffset := y * w
|
||||
yNextOffset := yNext * w
|
||||
|
||||
for x := 0; x < w; x++ {
|
||||
for x := range w {
|
||||
// Precompute x indices
|
||||
xPrev := (x - 1 + w) % w
|
||||
xNext := (x + 1) % w
|
||||
|
||||
+4
-4
@@ -72,7 +72,7 @@ func TestRules(t *testing.T) {
|
||||
// Set center
|
||||
a.Set(1, 1, alive)
|
||||
// Set neighbors
|
||||
for i := 0; i < activeNeighbors; i++ {
|
||||
for i := range activeNeighbors {
|
||||
nx, ny := neighbors[i][0], neighbors[i][1]
|
||||
a.Set(nx, ny, true)
|
||||
}
|
||||
@@ -134,8 +134,8 @@ func BenchmarkNextGen(b *testing.B) {
|
||||
next := New(size, size)
|
||||
|
||||
// Initialize with some pattern (e.g., random-ish)
|
||||
for y := 0; y < size; y++ {
|
||||
for x := 0; x < size; x++ {
|
||||
for y := range size {
|
||||
for x := range size {
|
||||
if (x+y)%2 == 0 {
|
||||
arena.Set(x, y, true)
|
||||
}
|
||||
@@ -143,7 +143,7 @@ func BenchmarkNextGen(b *testing.B) {
|
||||
}
|
||||
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
for b.Loop() {
|
||||
arena.NextGen(next)
|
||||
arena, next = next, arena
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user