[go-nuts] Strange custom Json Unmarshal alias method for nested structs

2022-10-07 Thread globalflea
Came across this blog http://choly.ca/post/go-json-marshalling/ that uses Alias to Unmarshal a struct (and avoiding recursion).. but when i tried a similar method with nested structs (with their own Unmarshal()) it no longer works. See code below. it seems that the Alias of the "derived" struc

[go-nuts] For range loop variable passing by reference to go routine causes memory leak

2022-10-07 Thread davy zhang
Original post on stackoverflow: https://stackoverflow.com/questions/73985794/for-range-loop-variable-passing-by-reference-to-go-routine-causes-memory-leak Code for reproducing the problem: https://go.dev/play/p/7Xzx1Aauzhh go version go1.19 darwin/amd64 go tool pprof http://localhost:6060/