A short post about a surprising Go behavior: when you expand a slice using variadic syntax (s...) and the called function captures it as a variadic parameter, both the caller and callee share the same underlying array. Mutating elements inside the function mutates the original slice. This is contrasted with Python, where *args

2m read time From ohadravid.github.io
Post cover image

Sort: