What problem are you trying to solve? There's no reason to avoid append --
it's the way the language provides to add items to an existing slice.

You can create a slice with a length higher than zero and then put things
in at specific indices:

x := make([]int, 10)
x[9] = 4
fmt.Println(x)


m = {1,2,3,4,5,6,7} doesn't work because it should be m =
[]int{1,2,3,4,5,6,7}

If you're worried about memory allocation, you can set the capacity in
advance and append() repeatedly without additional allocations.

Most importantly Go, is *not* whatever language you came from. It's Go.
Take the time to learn it. Write a couple of thousand lines of code in it.
Read "Effective Go." Follow this list. Showing up claiming to be a newbie
and then complaining about the way the language works will not help you,
nor will it motivate others to help you.

https://golang.org/doc/effective_go.html

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to