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, we learned about struct data type.
Now let's learn about array data type.
Array Data Type
Array is a collection of elements of the same type.
Declaring Array
Array is declared using var keyword.
var array_name [size]type
size is the number of elements in the array.
type is the type of the elements in the array.
Index Assignment
let's declare an array of strings with size 5 and assign values to it.
package main
import "fmt"
func main() {
var s [5]string
s[0] = "Hello"
s[1] = "World"
fmt.Println(s)
fmt.Println(s[0])
fmt.Println(s[1])
}
Here, we assigned values to the first two elements of the array using index.
s[0] is the first element of the array with Hello value.
s[1] is the second element of the array with World value.
Output:
gk@jarvis:~/exp/code/rd/go-exmaple$ go run main.go
[Hello World ]
Hello
World
Printing the array using fmt.Println prints the array in the format {element1 element2 element3 ...}.
Printing the index element will be in the format array_name[index].
Short Variable Declaration
let's declare an array of strings with size 5 and assign values to it using short variable declaration.
import "fmt"
func main() {
s := [5]string{"Hello", "World"}
fmt.Println(s)
fmt.Println(s[0])
fmt.Println(s[1])
}
Output:
gk@jarvis:~/exp/code/rd/go-exmaple$ go run main.go
[Hello World ]
Hello
World
As we didn't change any print statement, we got same output as previous example.
Update Array
let's update the array elements.
package main
import "fmt"
func main() {
var s [5]string
s[0] = "Hello"
s[1] = "World"
fmt.Println(s)
fmt.Println(s[0])
fmt.Println(s[1])
s[0] = "Hi"
fmt.Println(s)
fmt.Println(s[0])
}
Output:
gk@jarvis:~/exp/code/rd/go-exmaple$ go run main.go
[Hello World ]
Hello
World
[Hi World ]
Hi
We can see Hello is replaced with Hi.
Using Pointer With Array
let's declare an array of strings with size 5 and assign values to it using pointer.
package main
import "fmt"
func main() {
var s [5]string
p := &s
p[0] = "Hello"
p[1] = "World"
fmt.Println(p[0])
fmt.Println(p[1])
fmt.Println(s)
}
Output:
gk@jarvis:~/exp/code/rd/go-exmaple$ go run main.go
Hello
World
[Hello World ]
Conclusion
In this we learned about array data type and we also used pointer with array.
π 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 (0)