Go Basics - Map and Structs

While arrays and slices form the core of sequential data structures, maps, interfaces, and structs offer unique capabilities, especially when transitioning from a language like TypeScript. Lets talk about them today. Maps: Go’s Key-Value Store: 🔗A map in Go is a composite type that represents a hash table or a dictionary or object/map in typescript’s case. It associates keys and values where each key maps to a unique value. The key can be of any type for which the equality operation is defined, such as integers, floats, strings, etc.

Read article →

Go Basics - Arrays vs Slices

With this article I have tried giving a brief overview of two fundamental data structures in the Go programming language: arrays and slices. This may help anyone coming from a dynamic language to Go and understand the basics of couple of most used data structures in all programs . Arrays Arrays are fundamental data structures in the Go programming language that allow you to store and manage collections of elements of the same type.

Read article →

Go Basics - Pointers

In Go, a pointer is a variable that stores the memory address of another variable. We use the ampersand (&) operator to get the memory address of a variable, and the asterisk (*) operator to declare a pointer variable or to access the value pointed to by a pointer. In the example code provided, p is a pointer to the variable x. We can use the * operator to access the value stored in the memory location pointed to by p.

Read article →