- read

Switching from Python to Golang: My journey

Ashish Dhakal 50

As a backend developer, I have been working on Python Django for two years and it has been a great experience. However, I felt the need to explore new horizons in the world of web development and decided to switch to Golang. This article will detail my journey of switching from Python (Django) to Go (Gin), including the challenges I faced and my thoughts on both frameworks.


Making the switch from Python-Django to Go-Gin can be a challenging transition for any web developer. One of the biggest challenges I faced as a Django developer was writing SQL queries in Go. In Django, writing SQL queries is not a common task as the framework provides its own high-level ORM (Object-Relational Mapping) that allows developers to interact with the database without writing raw SQL. This made it easy for me to work with databases, as I could focus on writing Python code rather than worrying about SQL Queries.

However, in Go, the situation was quite different. The Go standard library does not include an ORM. So I am using a third-party library i.e; Gorm, It is also an Object-Relational Mapping (ORM) library that provides a high-level API for working with databases in Go but still needs tonnes of SQL queries which I found myself struggling to write, as I was not used to writing raw SQL.


Another challenge was that Go does not have built-in support for migrations, which made it difficult to manage changes to the database schema. In Django, migrations are a built-in feature that makes it easy to manage changes to the database schema, but in Go, I had to write manual SQL scripts to manage these changes.

Strict Typing

Shifting from the dynamically typed and interpreted world of Python to the statically typed and compiled landscape of Go is an eye-opening experience for me. In Python, dynamic typing allows to creation of variables without explicitly declaring their types, granting flexibility but sometimes leading to unexpected errors at runtime. However, in Go, strict typing takes center stage. Every variable and expression must have a defined type at compile time.

Pointers and Address

Here, it feels a bit different due to the explicit nature of pointers and addresses, How it works, and what is the purpose of using them. I was very confused at first as I didn’t need it while working on Python Django but in Golang I am seeing it (*/&) everywhere. Pointers and addresses provide more control over memory and data manipulation, they also require managing memory manually and need to be more cautious about potential issues like null pointers and memory leaks.

Invalid memory address or nil pointer dereference


Python is a versatile, high-level programming language known for its readability and ease of use, while Go is designed for performance, efficiency, and concurrency, making it an excellent choice for building scalable systems.