Skip to main content

Posts

Showing posts with the label Go

Golang Parallel Test and Subtest Execution

 Introduction In this section I will discuss the basics of unit testing, subtesting and parallel test execution in Go. Also I'm gonna demonstrate a unit test package  stretchr / testify which makes testing the code extremely easy. This post will be full of code snippets and their descriptions, so if you face any difficulties leave a comment at the end of the blog and I will get back to you as soon as possible. Unit Testing It is a methodology and language independent concept where we perform testing on all the code components like functions, methods, variables etc. The source code is tested for an objective purpose to prove that each unit of code is performing as expected. For more details you can visit Unit test basics . Go has it's own built-in testing package which needs to be imported while writing unit tests. Lets get started with some code. First of all I'm gonna create a directory ` jsonserializer ` and create a file ` serializer.go ` withing that. Add the followi...

Golang intro

Overview The Go language was designed and implemented by three very famous engineers: Ken Thompson, Robert Griesemer and Rob Pike at Google. By the way, the question will definitely be in your mind, why did they create the language? Or what was the problem they were trying to overcome which inspired them to create a new programming language, when there are already many powerful language available. The answer is efficient compilation , efficient execution , concurrency and of course ease of programming . Referring to the above mentioned things, you will again be thinking about the characteristics of Go, so first I will tell you about the syntax of Go, the language has strong/static type system so if you come from a dynamic type language like Python or JavaScript then it might be a bit unexpected for you. Well there is a sensitivity to strong/static types, system are typically associated with very verbose syntax. But as per the design decision around creating Go, the decision w...