So, I'm trying to get used to Go! and I've come up to a problem where I try making a new data type "RandomType" which contains a slice.
package main
type RandomType struct {
RandomSlice []int
}
func main() {
r := new(RandomType)
r.RandomSlice = make([]int, 0)
append(r.RandomSlice, 5)
}
This bit of code yields an error:
append(r.RandomSlice, 5) not used
However for instance if I try with
type RandomType struct {
RandomInt int
}
func main() {
r := new(RandomType)
r.RandomInt = 5
}
this works fine.
Not sure what I'm doing wrong.