Skip to main content

Working with Structs in Golang

In our previous tutorial, we have explained to work with Date and Time in Golang. In this tutorial, we will explain how to work with Structs in Golang.

Structs in Golang is a ability to create user-defined data type from group of data fields with different data types. The data field in a struct can be declared with built-in or user-defined data types.

The concept of struct can be compared with the object-oriented programming which supports composition but not inheritance. (more…)

Working with Date and Time in Golang

In our previous tutorial, we have explained How to Make HTTP Requests in Golang. In this tutorial, we will explain how to work with Date and Time in Golang.

Date and Time is a common functionality in web applications to display dates in different formats according to requirement. Sometimes we need to get current timestamp or sometimes need to convert timestamp into human readable date time format. In Golang, we can use Time package to handle date time functionality. (more…)

How to Make HTTP Requests in Golang

In our previous tutorial, we have explained about Channels in Golang. In this tutorial, we will explain how to make HTTP Requests in Golang.

There are net/http package is available to make HTTP requests. We just need tp import the package in our script and can use GET, POST, PostForm HTTP functions to make requests.

So here in this tutorial we will explain how to make GET, POST, PostForm HTTP requests in Golang. (more…)

Concurrency with Goroutines in Golang

In our previous tutorial, we have explained how to work with Maps in Golang. In this tutorial, we will explain about Goroutines in Golang. Goroutines are functions in Golang that are run concurrently which means multiple operations can be handled at the same time. It’s about creating and executing multiple processes independently.

With Goroutines, we can easily convert sequential programs into concurrent program without having to worry about thread pools as the Golang creates very light-weight threads that’s managed by Go runtime. (more…)

Working with Maps in Golang

In our previous tutorial, we have explained how to handle Marshalling and Unmarshalling in Golang. In this tutorial, we will explain about Maps in Golang. Map in Golang is a data structure that provides an unordered collection of keys/values pairs. Golang maps are same like associative arrays, hash or dictionaries in other programming languages.

The maps are used to store and access values based on key. A key works like an index, pointing to the value associate with that key. A map data structure is used for fast lookup, retrieval and deletion of the data based on keys. (more…)