Forem

Cover image for Golang perk series : *pointers in Go – basics #5
LG
LG

Posted on • Edited on

1 1

Golang perk series : *pointers in Go – basics #5

Pointers in Go := pass-by-reference :

Please refer to the sample by the name of pointers.go on REPLIT IDE

Before getting into pointers I want to examine this pseudo_code:

var pointer_variable *T = &another_variable // <= herein we defined a "pointer-to-memory" pair
/* 
such pair could either:
a) be referenced using ampersand (&), subsequently getting memory address
b) be DE-referenced using asterisk (*), subsequently getting UNDERLYING VALUE of memory address
*/
Enter fullscreen mode Exit fullscreen mode

JavaScript has some pass-by-reference -like behaviour with (outermost) object reference[s] but definitely none of native pointers specification [ – if you still fascinated by the idea of JS pointers, have a look at others/ifJS_pointers.go on REPLIT IDE ; also – pass by reference in JavaScript, stack overflow discussion]

We will see advanced pointers utilisation in structs & relevant fields, stay tuned for updates !


Articles :

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay