osc icon indicating copy to clipboard operation
osc copied to clipboard

Use of pointers

Open avlapp opened this issue 3 years ago • 2 comments

func (msg Message) Bytes() []byte) https://pkg.go.dev/github.com/scgolang/osc#Message.Bytes

As example.

I see other packages using a pointer there: func (msg *Message) Bytes() []byte)

avlapp avatar Sep 20 '22 12:09 avlapp

Why would the use of pointer receivers be a good thing when the method doesn't modify the struct?

tleb avatar Sep 24 '22 17:09 tleb

I'm fairly new to Go and pointers. I found this: https://youtu.be/29LLRKIL_TI?t=888 So I think your point is valid and on top of that, pointers are not concurrency safe.

avlapp avatar Sep 25 '22 11:09 avlapp