So far, we have talked about several programming languages, but until now, Go Programming Language, or Golang, has yet to fall into the discussion. Yes, it is not the most used of the languages, but it is growing in popularity, albeit slowly.
There is a good chance Go might catch on a great deal as Google is pushing it aggressively in many areas, but it has its downsides, so unless these problems are rectified, there is a chance it might not garner a very strong following compared to some of the most used.
Google Go Programming Language
Have you ever heard of procedural programming? Google Go is one of those languages. It was created by Google engineers Robert Griesemer, Rob Pike, and Ken Thompson in 2007. However, it was launched in 2009 and made open-source.
One of the main ideas behind Golang is that it should be easy to learn and simple to use. Furthermore, developers should have no problem reading the language. Now, unlike C++, we understand that Go does not have a large feature set, which might be a problem for some.
In its syntax, Go is quite similar to C, so creating content via Go should be a breeze if you are a long-term C developer. Nevertheless, we should note that many of its features hearken back to languages such as Erlang, which has been around for 34 years. We will no doubt discuss it in a future episode.
Also, many folks with no experience with Go have no idea that it has much in common with Java, which is why Google has been trying to push it aggressively in the server-side web apps space for quite some time, a space where Java reigns supreme.
Is Google Go cross-platform?
Cross-platform is very important for all programming languages if they are to succeed. Thankfully, we can say that Go can be used on Windows, Linux, Unix, BSD, and mobile devices. So, no matter which operating system you use, you should have little problems executing a code in Go.
Read: What is Angular JavaScript Framework for web development?
What about bugs?
An impressive thing about Golang is that it is not easy for bugs to strive in a code. You see, it relies on strong stylization, which means developers must be attentive and accurate when writing code for it to be safe.
It would be nice if all programming languages stay like this, but that is not the case. However, things are changing for the better.
Disadvantages of using Google Go
While we can agree that Go is an impressive tool, it has its shortcomings. The language is very easy to pick up and learn, and that’s a good thing. However, to some programmers, it is too simplistic, which makes it less versatile than similar tools.
Another thing we do not like about Go is that it does not support a virtual machine. The lack of this was a conscious choice by the folks at Google for the sake of simplicity. Because of this decision, the size of a Go file is usually larger than competing services. Not to mention, Go will eat through your RAM like a child devouring candy on Halloween.
Finally, if you are a fan of generics, you’re out of luck because Go does not support them. There have been quite a few discussions about this, but nothing has happened on that end so far.
Google Go coding examples
Like all others, we will focus on running Hello World! because this is the standard, it seems.
OK, so first you must create a folder called studyGo. From within this folder, will be creating our Hello World! program.
Next, create a file called first.go, then add the following code to that file:
package main import ("fmt") func main() { fmt.Println("Hello World! This is my first Go program\n") }
From within your terminal, navigate to the folder, then run the following command:
go run first.go
You should now see the following output:
Hello World! This is my first Go program
That’s it for that. Now go ahead and increase your knowledge.