Overview It is possible to create a slice or array of float data type in Golang as well. In fact, a slice or array can be created of any data type in…
Tag: golang
Create Slice or Array of Integers in Go (Golang)
Overview It is possible to create a slice or array of int data type in Golang as well. In fact, a slice or array can be created of any data type in…
Slice or Array of Bool in Go (Golang)
Overview It is possible to create a slice or array of bool data type in Golang as well. In fact, a slice or array can be created of any data type in…
Slice or Array of Channels in Go (Golang)
Overview It is possible to create a slice or array of channel data type in Golang as well. In fact, a slice or array can be created of any data type in…
Slice of Map in Go (Golang)
Overview It is possible to create a slice of map data type in Golang as well. In fact, a slice can be created of any data type in Go. Below is a…
Slice of Struct in Go (Golang)
Overview It is possible to create a slice of struct in Golang as well. In fact, a slice can be created of any data type in Go. Below is a simple example…
Append or Add to a Slice or Array in Go (Golang)
Overview In golang, the size of the array is part of its type. That is why the length of the array is fixed during creation and cannot be changed later. This is…
How to check if a map contains a key in Go (Golang)
Below is the format to check if a key exists in the map There are two cases If the key exists val variable be the value of the key in the map and ok variable will…
Read a file into a variable in Go (Golang)
Overview There are various ways of reading a file into a variable in golang. Here are some of the ways Using ReadFile function provided by the ioutil package Using os.Open and then…
Return an image or file in HTTP response in Go (Golang)
Overview Write method of the ResponseWriter interface in net/http package can be used to send the image or file body in an HTTP response body. When we send a file or image…