Skip to main content

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 was made to put as much emphasis on compiler helping you figure out what the types are rather than you figure it out Single binary output is another feature of the language, which does not mean that it contains all the assets of an application,on your own.

The syntax for Go is inspired by C, and some of the features are also derived from Python and JavaScript which we will see in more detail later, and also, that Go is a multi-paradigm language, meaning that it is procedural as well as object oriented. Being a multi-paradigm, we do not have to create objects for everything here nor do we have to use processes for everything. Almost all types of programs are a mixture of procedure and object oriented code based on a specific type of problem. It is strongly encouraged throughout the community to look at your use case, and to adopt a procedural or object oriented style.

Go is a garbage collected language, which means that, when you are working with Go, you will not need to manage your memory. This was a decision taken to make the language stronger. Go also focuses on rapid compilation, so one concern with some languages ​​that they have longer compile time which was very hard for engineers to stay in a nice productive flow, as they write tests and rapidly compile the application and make sure that things are working.

Single binary output is another feature of the language, which does not mean that it contains all the assets of an application, If you are building a web application, you can have additional HTML, CSS, JavaScript files, but all Go code is compressed into a binary. The reason behind this is simple deployment. But you can also write a separate library and allow an application to use it and discover functionality at run-time. But the primary use case for Go is to compile it into a single binary.

Go has built many applications such as Doktor, Kubernetes. Speaking in terms of companies, Uber, Facebook, Netflix Digital Ocean and Google are regularly using it in their production environments.

Keeping it small and sweet lets end the lesson here, I shall come up with language specifications and advanced concepts in coming posts. Feedback appreciated!

Best Regards,
Dave

Comments

Post a Comment

Popular posts from this blog

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

Reverse engineering - Get root shell access to D-Link router using UART(Get WiFi password)

Introduction Hello there. In this article I will be showing you a very commonly used reverse engineering and hardware hacking technique to gain root access to the shell of a WiFi router and retrieve the WLAN SSID and password. It also works for many other kinds of embedded devices too but here I will be showing you my experience with a WiFi router D-Link DSL-2730U. This is my first blog ever so it is a brand new experience for me. Although I will do my best to make this content a very valuable and interesting one. NOTE: If you find any incomplete, missing or even misleading information here, then please put it in the comments. I would love to learn even more. Prerequisites It is best if you have a fair amount of experience in the following: Linux fundamentals and sysadmin skills. Fair amount of hands-on experience with Arduino or Raspberry Pi projects. Building custom Linux systems for embedded devices(Buildroot, Yocto, Busybox, etc.). Protocols like - UART, SPI, I2C, etc. You do not n

Little on Linux

I used to be an average Windows operating system user, who was just using a system to browse the internet and play computer games, then my friends  Irak Rigia  introduced me to Linux. My early days with the newly introduced OS were not so good, I used the Ubuntu GUI to perform my basics tasks such as moving files and deleting files. But gradually I started learning terminal basic commands and things changed. Now I have four inter-connected Linux machines  at home which I use to learn Linux and networking. Now I have found linux in a straightforward form, and understood the principle behind an operating system. The intention of this article is not to show Windows as a bad OS, they are great and also amazing in terms of user interface, but they don't reveal what goes behind the scene. But again it’s personal preference. Ok, that was about my journey with Linux, now let me tell you that how you can be a power user? and what can be accomplished using Linux? Linux