TryBugHunt

Go slice exercises

In Go, slices are three-word headers pointing to underlying arrays. Subtle bugs occur when append reallocates unexpectedly, copy fails because the destination length is zero, or sub-slicing shares mutated memory across functions.

Each exercise is a focused Go function with one real bug and automated tests to verify your fix.

See the 28 exercisesOr follow the 30-day path

The slices bugs you will meet

The exercises

Medium

Errors you might be searching for

More JavaScript practice by topic

Questions

Do I need Go installed?

No. Test verification runs through BugHunt's instant execution runner.

What makes Go slices tricky?

A slice is a lightweight view over an array. Passing a slice to a function passes the header by value, but modifying existing indices mutates the shared underlying storage.