Hello, I'm Ganesh Kumar. I'm working on git-lrc: a Git hook for Checking AI generated code.
AI agents write code fast. They also silently remove logic, change behavior, and introduce bugs -- without telling you. You often find out in production.
git-lrc fixes this. It hooks into git commit and reviews every diff before it lands. 60-second setup. Completely free.
Here is the corrected version of your blog post with improved grammar and flow, while maintaining your personal style:
In my previous post, I explained how to work with arrays and use pointers with arrays.
Now let's learn about slices in go.
What is Slices
Slices are dynamic arrays.
Slices use pointers to refer to the underlying array.
Here is how you can create slices.
How to create slices
Initialize array and create slice from it.
For creating slice from array, we use [start:end] notation.
start is the starting index of the slice.
end is the ending index of the slice.
import "fmt"
func main() {
s := [5]int{10, 20, 30, 40,50}
fmt.Println(s)
var s1 []int = s[1:3]
fmt.Println(s1)
}
Output:
[10 20 30 40 50]
[20 30]
How Slices Work Internally
Slices will be having 3 components.
- Pointer to the underlying array.
- Length of the slice.
- Capacity of the slice.
It is little bit confusing, let's understand with above example.
[10, 20, 30, 40, 50]
Now by above image we can understand how it works internally.
Conclusion
In this we learned about slice data type and how it works internally.
π Check out: git-lrc
Any feedback or contributors are welcome! Itβs online, open-source, and ready for anyone to use.
β Star it on GitHub:
HexmosTech
/
git-lrc
Free, Unlimited AI Code Reviews That Run on Commit
AI agents write code fast. They also silently remove logic, change behavior, and introduce bugs -- without telling you. You often find out in production.
git-lrc fixes this. It hooks into git commit and reviews every diff before it lands. 60-second setup. Completely free.
See It In Action
See git-lrc catch serious security issues such as leaked credentials, expensive cloud operations, and sensitive material in log statements
git-lrc-intro-60s.mp4
Why
- π€ AI agents silently break things. Code removed. Logic changed. Edge cases gone. You won't notice until production.
- π Catch it before it ships. AI-powered inline comments show you exactly what changed and what looks wrong.
- π Build a habit, ship better code. Regular review β fewer bugs β more robust code β better results in your team.
- π Why git? Git is universal. Every editor, every IDE, every AIβ¦


Top comments (2)
Nice overview of slice internals! One thing worth mentioning is the gotcha with
appendβ when a slice exceeds its capacity, Go allocates a new underlying array. This means two slices that originally shared the same backing array can diverge silently after an append. It's one of those things that trips people up in production when they're mutating slices passed between functions. The diagram really helps make the pointer/length/capacity relationship click.Thanks for letting me know.
I have started learning in depth on these concepts.
Will surely mention these gotcha in upcoming articles.