Hacker News new | ask | show | jobs
by sqlcommando 1283 days ago
I don't understand what you mean by this.

  [~] $ cat main.go 
  package main

  import "fmt"

  func main() {
   x := []int{1, 2}
   append(x, 3)
   fmt.Println(x)
  }
  [~] $ go run main.go 
  # command-line-arguments
  ./main.go:7:2: append(x, 3) (value of type []int) is not used
and if you assign the result of the append to something else, x is unchanged.