DRYな備忘録

Don't Repeat Yourself.

2014-12-13から1日間の記事一覧

【Go言語】固定長arrayからsliceへの変換 "convert array to slice"

go

こうです arr := [4]byte{10, 20, 30, 40} slc := arr[:] fmt.Printf("%T\n%T\n", arr, slc) Go Playground 参考 Go Slices: usage and internals - The Go Blog ここにちゃんと書いてあった This is also the syntax to create a slice given an array: x :…