Category: Golang

Golang HTTP HandleFunc | Request Routing

Web Development is all about multiple routing, so we have to define more than one URL route in a Go Web Application using Golang net/http HandleFunc to enable multiple Request Routing. This also includes mapping of the path to the respective Handlers and resources. In this example, we are going to make three endpoints, such…
Read more

Creating a Simple HTTP Server in Golang

A Simple HTTP Server in Golang can easily be created using Golang’s net/http package. In this blog, we will be creating a simple HTTP Server in Golang that will render some text on the browser. Create a http-server.go file and copy the code. Golang HTTP Server Run the program from the command line. After running…
Read more

Golang ResponseWriter & Request | Handler Interface

The Previous Blog we talked about How the Golang HTTP Server is created using the Golang TCP Server using the Go Net Package. In this blog, we will take a look at Golang ResponseWriter and Request in net/http package Handler Interface. But we don’t have to make that much effort just to create a server…
Read more

Golang Pointer Garbage Collection – Memory Management

Garbage Collection means that you don’t have to take care of the deallocated memory. In Golang, memory is automatically reclaimed when it is not in use. Golang uses Pointer Garbage Collection and we don’t have to free up the allocated memory. If you come from a high-level language background like Java, Python, Ruby, C#, etc,…
Read more

Command-Line Arguments in Golang

The os package in Golang provides various functions in order to deal with the operating system in a platform-independent manner. Command-Line Arguments in Golang are available to a program in a variable named Args that is part of the os package. The Args variable can be accessed using ‘os.Args‘. os.Args variable is a slice of…
Read more

Golang TCP – Build HTTP Server – Go Net Package

In this blog, we will learn about the Golang TCP and how we can build Go HTTP (Hypertext transfer protocol) Server using TCP (Transmission Control Protocol) from the Golang Net Package. To use Golang TCP and related functions we are going to use the Net Package. import “net” Golang HTTP is built over TCP, as…
Read more

Golang Fprintf, Fprint, and Fprintln | Go FMT Package

In this blog, we are going to look at Golang Fprint, Fprintf, and the Fprintln Format functions from the Go FMT package. Import Golang fmt package to use this Format function. Golang Fprint func Fprint(w io.Writer, a …interface{}) (n int, err error) The Golang FMT package Fprint function takes a writer and variadic parameter in…
Read more

Convert String to Bool in Golang

In the previous blogs, we learnt about conversion between int and string, string and float in Golang. This time we are going to convert String to Bool in Golang. Learn the above conversions. Convert String to Bool in Golang Using Strconv ParseBool func ParseBool(str string) (bool, error) The Golang Strconv ParseBool Function takes a string…
Read more

Convert between Float and String in Golang

In the previous blog, we learnt about int to string conversion and string to int in Golang. This time we are going to learn how we can convert between float and String in Golang. learn the above conversions from here. Convert Float to String in Golang func FormatFloat(f float64, b byte, prec, bitSize int) string…
Read more

Convert String to Int in Golang

In the previous blog, we learned about how to convert from int to string in Golang. This time we are going to learn how we can convert a string (number as string) to int in Golang, so that we can perform numerical operations on it. Learn int to string conversion from here. Convert String to…
Read more