Skip to content

Instantly share code, notes, and snippets.

View A4rmin's full-sized avatar
🥵
Focusing

Armin Moraghah A4rmin

🥵
Focusing
View GitHub Profile
@samuelfvlcastro
samuelfvlcastro / faq.md
Last active August 23, 2024 00:53
GoLang Tips and Tricks

FAQ

Q: pointers vs values (in general) ?

A:

Don't pass pointers as function arguments just to save a few bytes.

Don't pass a pointer to a string (*string) or a pointer to an interface value (*io.Reader). In both cases the value itself is a fixed size and can be passed directly.

Use pointes on large structs, or even small structs that might grow.