According to Wikipedia, Go (or Golang) is a programming language that was developed by the Google team and first appeared in 2009. It was designed specifically for backend development and infrastructure projects.
Go is an open source programming language that enables the production of simple, efficient, and scalable software.
The following projects come to mind, which are completely written in GO:
- Docker is a container management engine.
- Kubernetes - clustering system for containers. Developed by Google and is an open source system.
- Traefik is a load balancer developed by Traefik Labs.
- Consul, Terraform - infrastructure management tools developed by Hashicorp.
In the github trends at this link you can find hundreds and thousands of other projects.
As you can see, GO is very popular for server projects, but it is also heavily used for console application development because it can compile binaries that are very fast and small.
My personal preference for the GO programming language are the following:
- portability - compiled an executable file that can be safely used on other computers. It does not require any additional software to be installed;
- cross-platform - you can compile binaries for various operating systems: Linux, Windows, MacOs. At the same time, they are generated quite simply - with the
go buildcommand. By default, Go uses static linking. This means that the generated binaries can be easily transferred to other computers with the same OS. As a result, after successfully compiling a GO program and creating an executable, you don't have to worry about libraries, dependencies, and other things;
- concurrency - Go has a built-in concurrency mechanism, which makes it a very convenient tool for developing projects where there are tasks that need to be performed in the background;
- ecosystem - a large number of libraries and interesting projects have already been developed. Some of them are listed below.
- easy development - Go includes a built-in unit testing system and a profiler, while they are very easy to use;
- standardized development - Go automatically formats written code, so it's very easy to read other developer's code and deal with existing projects.
As already mentioned, for Go there are a large number of ready-made tools and packages available immediately after installation. They are called stdlib. All of them greatly simplify the life of the developer. The functions included in the standard library are pre-tested and debugged by developers. For the most part they work without errors. There are also a large number of packages available separately for installation. There are many ready-made interesting projects, my favorite is https://github.com/cortezaproject/corteza. Here is a list of the most popular packages:
- crypto - ready-made libraries for working with cryptography
- compress - for working with archives.
- http is a very powerful and simple http client. Thanks to it, you can create web applications and raise your web server.
- net - works directly with sockets, url-addresses and dns.
- encoding/json - works directly with json files.
- text/templates - allows you to generate html pages.
- os - allows you to work with operating system primitives.
A complete list of prebuilt packages can be found here: https://golang.org/pkg/
Does this mean for me that from now on I will stop programming in php and switch only to GO? Of course not. Like any other programming language, go has a number of disadvantages.
- Go is not for a quick start. It is impossible to quickly raise some simple project for market testing on it. If a customer came to you who needs it quickly, cheaply and as simply as possible, then go is definitely not applicable here.
- GO does not have built-in support for object-oriented programming. This is a bit of a problem because I'm used to structuring my project with DDD. In GO, this can also be implemented, but it does not look as clear as in PHP. However, it is possible to simulate inheritance in GO using composition.
- Development on it is always longer and more expensive. This is due primarily to weak documentation. In terms of language, there is only one very useful book that few people know about - "Learning Go" by Miek Gieben. In the official documentation for modules, most often only methods are listed, without any description. This greatly increases the entry threshold, which adversely affects the size of the language community.
Despite all this, I see GO as a decent programming language. While studying, he has not disappointed me yet. I have already written several projects on it, the syntax itself is to my liking. If I need to write some simple microservice, a console application, a project that will work under heavy load, then my choice will definitely fall on GO.