Golang

The Go Programming Tutorials

Golang MySQL CRUD Example

MySQL is one of the most used relational database engines in the world. It provides a simple and clear interface as well as integrations to many different programming languages. In this post, we will connect to MySQL with Golang. Installing MySQL Installing MySQL is pretty simple in any OS. There are multiple ways it can […]

Golang MySQL CRUD Example Read More »

Using XML in Golang

XML is a data-interchange format. It is heavily used alongside with JSON. Working with XML is simple in Golang. In this post, we will see how to work with XML in Golang. Required imports To work with XML we need to import encoding/xml package. Encoding with XML Now, we can start working with XML in

Using XML in Golang Read More »

REST API in Golang

REST API is by far the most used form of API in the world. This post will focus on creating a simple REST API in Golang. What is the REST API? REST stands for Representational State Transfer. It is a way clients connect to servers to get data. The server serves the data via HTTP/HTTPS.

REST API in Golang Read More »

HTTP server in Golang

Creating HTTP services in Go is not complex. The HTTP package saves us a lot of time when doing so. In this post, we will work with the HTTP package to create an HTTP server in Go. Required imports To work with HTTP we need to import the HTTP package. It contains client and server

HTTP server in Golang Read More »

Polymorphism in Golang

In Object-Oriented Programming, an object can behave like another object. This property is called polymorphism. This post will cover how we achieve polymorphism in Golang. What is polymorphism? Polymorphism is a property that is available to many OO-languages. Go despite not being an OO-language achieves polymorphism through interfaces. Polymorphism using interfaces In Golang, polymorphism is

Polymorphism in Golang Read More »

Inheritance in Golang

Object-oriented programming is a paradigm that works with objects and has 3 properties – Inheritance, Encapsulation, and Polymorphism. Go also supports OOP, but it’s not like other object-oriented languages. It doesn’t support classes. This post will show how go achieves inheritance without classes. What is inheritance? In OO-languages inheritance refers to the property that a

Inheritance in Golang Read More »

Concurrency in Golang

Concurrency is when a large task is split into smaller sub-tasks and run at the same time. This post provides an outline of how Go handles concurrency. Goroutines Goroutines are an integral part of Go. They are the units of execution inside a Go program. The main function is also another goroutine. They all have

Concurrency in Golang Read More »

Mutex in Golang

Mutexes are an important topic in concurrency. They appear in almost every programming language when they talk about concurrency. In this post, we are going to look at what problems mutexes solve and how. The race condition The race condition appears when multiple goroutines try to access and update the shared data. They instead fail

Mutex in Golang Read More »