Tianchi YU's Blog

Learning GoLang - Day 1 : 初见

Actually, this may not be the first time I started to learn Golang, but I didn't take it seriously. Currently, because of my working needs, I have decided to study it every weekday and one hour each day. After the learning hour is up, I'll share some important notes here.


Today, following the A Tour of Go, I learned the language basics. Its concepts are not too hard to understand, especially if you know the C language well before. But there are several points that I think are pretty important to highlight which show the part of the uniqueness of this language.

s := []int{2, 3, 5, 7, 11, 13}
// Slice the slice to give it zero length.
s = s[:0]
// len=0, cap=6
// Extend its length.
s = s[:4]
// len=4, cap=6
// Drop its first two values.
s = s[2:]
// len=2, cap=4 

This is what I learned today, see you tomorrow.

#golang