Golang

The Go Programming Tutorials

The scanner Package in Golang

Go contains a scanner package that can be used to tokenize any source code written in Go. This post will provide an outline of how to use the scanner package in Go. What is tokenization? Tokenization is the method a source code is parsed to different tokens or identifiers. It is an important step used […]

The scanner Package in Golang Read More »

Code Coverage in Golang

Code coverage is the way of determining how much of the code is actually covered through the tests. This metric is extremely useful in determining what other tests need to be written. This post will explore code coverage in Golang. What is code coverage? Code coverage is the way to determine the test coverage of

Code Coverage in Golang Read More »

Benchmark functions in Golang

Go offers benchmarking via the testing package. In this post, we will try doing simple benchmarks to see how it works. What is a Benchmark? A benchmark by the dictionary definition is a standard, with which the same type of things may be compared. In programming, benchmark tests the time of execution for an operation.

Benchmark functions in Golang Read More »

Unit testing in Golang

Unit testing is essential when creating software. It tests each component one after another but does not test it entirely. In this post, we will use the testing package to do some unit testing in Go. What is testing? Testing is when we want to check the correctness of our code. It’s a really important

Unit testing in Golang Read More »

Closures in Golang

Go has support for first-class functions, which means the functions can be used pretty much everywhere. This creates a new property for the function to become aware of its surroundings. This property is called the closure property. What is Closure in Golang? Closure occurs when an anonymous function in Go has access to its surroundings.

Closures in Golang Read More »

Reflection in Golang

Reflection is an advanced programming concept, which in some programming languages allows the program to check types and values at runtime. Go has a package for reflection – the reflect package. In this post, we are going to discuss how to do reflection in Go. What is Reflection in Programming? Reflection is the way a

Reflection in Golang Read More »

The “time” package in Go

The time package contains everything useful about time. In this post, we are going to explore the time package in Go. The Sleep() function in time package First, we need to import the time package to do something with it. The time package has a sleep function that can pause the main Go thread. The

The “time” package in Go Read More »