-
Go: What is rune?
One of the new concepts developers encounter when working with strings in Go is the rune. As shown in the code below, s[0] is a byte, and its ASCII code is 72. However, the code below results in a compilation error, stating that ch is of type rune, not byte. If you examine Go’s internal…
-
Go: cannot assign to struct field in map
One of the surprising things beginners realize about Go is that maps are passed by reference. This means if a map is modified in the function it was passed to, the caller will also see the changes. However, if m is a map[int]node, m[0] is not a reference to a node but the value stored…
-
Go DOES NOT have references!
As a beginner, I found it a bit confusing to work with slices in Go. Even now, I sometimes forget this. When reviewing code, I often see that colleagues pass pointers to slices in an attempt to optimize performance. Or people might be hesitant to slice a slice because they’re concerned it could affect performance.…
-
Go Docs are good, but not enough!
I believe programming language standard library documentation should mention the time and space complexity of every operation. Currently, Go docs only explain how to use data structures, but nothing more. This is unacceptable. I need to know how much time it takes to initialize an array of size n without reading the source code. One…
-
A look into Go Scheduler’s Design
Go is a relatively recent language designed with concurrency first in mind (from introduction to Go byRob Pike). Its standard library is state of the art code written by coders who worked on Unix. My focus in my grad studies, from general to specific was Distributed Computing -> Concurrent Algorithms -> Shared Data Structures. I…
-
Mastering the Art of Reading Go code
* I could not come up with any good name for this post, so here it is. It is a case study for reading go code. I have worked with Java/Python for more than 9 years now. Most of my production code was in Java. When I want to write a code to parse some…
-
Concurrency in Go
I chose GoLang to implement the algorithm that I was working on in my masters. You can find my repo here. After this experience I wanted to write on Go’s concurrency as a newbie gopher. Concurrency was important to Go designers so they developed it built in. Instead of using threads to achieve concurrency like…