3 ms·
Even for bad/inexperiences/stressed/inattentive/... developers, Go is a minefield. Just a trivial example: trying to use append(x, y) without re-assigning to x
by shakow 4y ago
Even for bad/inexperiences/stressed/inattentive/... developers, Go is a minefield.
Just a trivial example: trying to use append(x, y) without re-assigning to x? Congrats, it will compile without warnings, work fine for a while, then at one point append will reallocate and bang, have fun letting the newbie debug that on a Friday evening.
- sqlcommando 4y agoI 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.