Skip to content

Use of pointers #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
avlapp opened this issue Sep 20, 2022 · 2 comments
Open

Use of pointers #11

avlapp opened this issue Sep 20, 2022 · 2 comments

Comments

@avlapp
Copy link

avlapp commented Sep 20, 2022

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)

@tleb
Copy link
Contributor

tleb commented Sep 24, 2022

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

@avlapp
Copy link
Author

avlapp commented Sep 25, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants