Although it appears that I'm late to the Gophers party, I have finally managed to embrace Idiomatic Go in my programming arsenal. I now realized that better late than never. Golang is truely a highly productive language In this post, I'm gonna talk about my new project lsgo - ls command in golang for fun & learning . |
After watching various Gophercon videos , Rob Pike’s “Concurrency is not Parallelism” & Liz’s “Containers from Scratch” , I was super charged in getting my hands dirty with golang
.
Rather than starting out in traditional hello-world world, I decided to take a spin and wanted to try with real-world program.
Well, who doesn’t know about ls
command?? . Simple, yet powerful. So what about, implementing ls
command from scratch using golang
? and how much time does a newbie like me, would typically need in converting an idea to implementation, using golang
??
As it turns out, it only took me a weekend to learn golang
basic & it’s powerful idioms, there by implementing a subset of mighty ls
command purely in golang
.
The power of golang is such that, what started out as something very trivial as below
ramped up into a complete tool within short span of time ( read productivity ). No wonder why every start-up is thriving with golang
.
Needless to say, the experience was so much fun & absolutely addictive. I’m sure I’m gonna use golang
for all my future coding endeavours.
lsgo
project??lsgo
is available in Github. While not all features of ls
isn’t available, this tool serves PWD
& any directory when provided as an input.
Along with normal file listing, this tool also supports long, size in human readable format, file-only, dir-only listing. Furthermore, it also supports tree lookup (recursive directory lookup) .
The goal is not to replace ls
, rather than to mimic ls
in golang to the extent possible using native golang
constructs - basically for fun & learning golang.
If you happen to like my project, feel free to let me know your thoughts and I would love to hear them. Cya in my next blogpost..