Go Programming Language

that programming language with a rodent mascot.

Created: by Pradeep Gowda Updated: Jun 24, 2024 Tagged: programming-language · golang

Go is the only programming language that has been designed from the ground down. – vzverovich

Go advocates for making thread creation easy and light-weight and for using message passing over shared memory for inter-thread communication. Indeed, we saw more gor-outines created in Go programs than traditional threads andthere are significant usages of Go channel and other message passing mechanisms. However, our study show that if not used correctly, these two programming practices canpotentially cause concurrency bugs.

Shared memory vs. message passing: Our study found that message passing does not necessarily make multi-threaded programs less error-prone than shared memory.In fact, message passing is the main cause of blocking bugs.To make it worse, when combined with traditional synchro-nization primitives or with other new language featuresand libraries, message passing can cause blocking bugs thatare very hard to detect. Message passing causes less non-blocking bugs than shared memory synchronization and sur-prisingly, was even used to fix bugs that are caused by wrongshared memory synchronization. We believe that messagepassing offers a clean form of inter-thread communicationand can be useful in passing data and signals. But they areonly useful if used correctly, which requires programmersto not only understand message passing mechanisms wellbut also other synchronization mechanisms of Go.

Project structure

A very common question Go beginners have is “how do I organize my code?”. Some of the things folks are wondering about are:

  • How does my repository structure reflect the way users import my code?
  • How do I distribute commands (command-line programs that users can install) in addition to code?
  • How do modules change the way I organize my code?
  • How do multiple packages coexist in a single module?

Moving to Go



The Go Programming Language by Donovan and Kernighan.



Development practices

The Go team has published official guidelines for organizing / structuring a Go project: https://go.dev/doc/modules/layout This includes recommended project layouts for different kinds of projects: a simple package, a command-line tool, a mix of the two, etc. via

Deployment practices

Performance monitoring

User Groups



  • Go-git discussion about this git client library [esp see gogit].
  • webgo.io – inspired by web.py
  • Go-LINQ – LINQ for Go.
  • Godep – Go package dependency management.
  • Gox – Go cross compile tool.
  • overseer – Monitorable, gracefully restarting, self-upgrading binaries in Go

Read Code

List of Lists on Go

  • Awesome Go – A curated list of awesome Go frameworks, libraries and software.



Garbage Collection

Why Discord is switching from Go to Rust - Discord Blog

In Go, on cache key eviction, memory is not immediately freed. Instead, the garbage collector runs every so often to find any memory that has no references and then frees it. In other words, instead of freeing immediately after the memory is out of use, memory hangs out for a bit until the garbage collector can determine if it’s truly out of use. During garbage collection, Go has to do a lot of work to determine what memory is free, which can slow the program down. These latency spikes definitely smelled like garbage collection performance impact, but we had written the Go code very efficiently and had very few allocations. We were not creating a lot of garbage. After digging through the Go source code, we learned that Go will force a garbage collection run every 2 minutes at minimum. In other words, if garbage collection has not run for 2 minutes, regardless of heap growth, go will still force a garbage collection.

garbage collection - How fast is the go 1.5 gc with terabytes of RAM? - Stack Overflow

3-4ms pauses under 1.6, with about an 8GB heap and 150M allocations/minute.


Programming notes


Package management



  • Go Blueprint Hello – “Choose your desired features, and we’ll generate the command you can use to create your project.”

  • blackfyre/wga: Jumping forward ~30 yearsThis repositry contains the code for the Web Gallery of Art project. The project is a web application that allows users to browse through a collection of paintings, sculptures and other forms of Art. This project is inteded to shave off the 3 decades of tech debt on the original website and provide a modern, responsive and user friendly experience with the same content. – study this project and the choices it has made – pocketbase, htmx, bulma, golang, sass, and goreleaser

  • anthdm/superkit still in development.


templ – “A HTML templating language for Go that has great developer tooling.” github

package main

templ Hello(name string) {
<div>Hello, { name }</div>

templ Greeting(person Person) {
<div class="greeting">