Substring in Golang

Substrings are a part of a string. Creating it from a string is really easy in Go. This post covers the best possible ways to generate substring from a string. Get a single character from a string Getting a single character can be done using simple indexing. Here is an example. Remember to convert it

Substring in Golang Read More »

The math Package in Golang

The math package in Go contains entirely of many math functions that can be used to do different things. Here are the main math functions that are used frequently. Regular math functions The most common math functions are as follows. Most of the functions work with float64 type here. We need to import the package

The math Package in Golang Read More »

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 »