func main() {
v := []rune(os.Args[1])
if len(v) > 12 {
v = v[:12]
}
fmt.Println(string(v))
}
Or more in the spirit of the C example in the post: func main() {
res := make([]rune, 12)
copy(res, []rune(os.Args[1]))
fmt.Println(string(res))
}
Note that res will stay on the stack, just like C.I expect the author is trying to say something about Go that I'm not quite getting. Perhaps that it is not an expression-based language, so to make code readable you need to make use of multiple statements. That's by design, but I understand it may be unappealing if you want to program in an expression-heavy style.