Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
Joker_vD
on Aug 12, 2024
|
parent
|
context
|
favorite
| on:
Go structs are copied on assignment (and other thi...
Well, if you don't mind that it doesn't work correctly with slices: [0], then sure, you may return indices.
[0]
https://go.dev/play/p/Q2ntuaugbGQ
maerF0x0
on Aug 12, 2024
|
next
[–]
That didn't work because you didn't pass the same slice in. You subsliced your things slice, which outputs a new slice.
benmmurphy
on Aug 12, 2024
|
prev
[–]
It does work with slices as long as you use the slice to update as well
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
[0] https://go.dev/play/p/Q2ntuaugbGQ