False positive with using loop variable as a pointer
Closed this issue · 2 comments
vendelin8 commented
https://go.dev/play/p/Uu5xmbWdvDY
The workaround to this would be to change line 11 to:
sTmp = string(s)
ssPtr[i] = &sTmp
But this gives unnecessary conversion (unconvert)
dmitshur commented
Is it possible to use the workaround of changing line 11 to this instead?
s := s
ssPtr[i] := &s
Does that avoid unnecessary conversion (unconvert)
?
vendelin8 commented
Yes, thank you. Works fine.