Go was created in 2007 at Google as an experimental project. It was designed to be a fun language and at the same time it is productive, practical, expressive and powerful. Google Go can be considered the result of a rather conservative language evolution from languages such as C and C++.
Node.js is an increasingly popular platform that is built on fast, JavaScript-based runtime: V8. V8 is a JS virtual machine created by Google that is designed to build scalable, networked applications. It compiles JavaScript code to native machine code, using some complex optimizations. V8 also does the memory allocation and garbage collection of JS objects.
Recently, there have been criticisms about the value of using Node.js in a high-performance, networked application environment, and some developers have moved to the Go language. Not only developers but also some well-known companies, such as Google, DropBox, Docker, DigitalOcean and more have picked up Go for some of their projects.
Certainly, Node.js is still used by a much wider audience, has more modules, is easier to use and isn’t going anywhere anytime soon. However, Go is gaining more and more popularity. In this article we will take a look at the differences between Node.js and Go to reveal the strengths and weaknesses of each environment.
Performance
Due to JS’s dynamically-typed nature Node cannot reach the raw performance of CPU or memory bound tasks that Go can achieve in many tests. Go is about 3 times faster and more lightweight than Node.js in a production environment. Not to say that Node.js is slow, it’s fast enough for most use cases, but when you do hit a limit, Go can still go a long way.
Concurrency
One of the language’s peculiarities is the presence of goroutines, functions that can be executed concurrently with one another.
These can be launched simply by using a keyword. Go runtime contains a scheduler that coordinates the execution of an arbitrary number of goroutines on an arbitrary number of system threads (the M:N model). In this way it is possible to carry out rapid context switches in order to take advantage of all CPU cores. So, in a hypothetical web application written in Go a single process will be able to continue serving requests even if one of these is trying to execute a blocked operation.
Node suffers from JavaScript’s less than elegant concurrency support using the event-callback mechanism. However, for a lot of applications working with JS promises and the coming async generator support (also called “semi-coroutines”) will suffice. Something like the Koa framework is already supporting the async generator approach in Node.
Ease of use
Node.js is a much simpler platform to use, especially if you are already a JS developer. For Go you will need to learn some new programming concepts, such as: coroutines, channels, strict typing (with compilation), interfaces, structs, pointers, and some other differences.
Ecosystem
Both platforms have pretty active and growing ecosystems, but as Node.js has been around much longer and certainly it has a broader community of users and more tools that make certain software projects a lot easier and/or cheaper to implement.
Go is a younger language, however, it dynamically develops: the number of standard Go packages is growing steadily, currently at over 100, and the Go community packages can be searched easily.
In conclusion, I’d like to say that there is no ideal language/framework/tool that could be used by everyone otherwise there would be only one programming language and there wouldn’t be such debates as Go vs Node.js:) Every language is tailored to be used for specific use cases. But we need to admit that there are some things Go performs better in, at the same time it lacks some characteristics that Node.js provides.
And what advantages and disadvantages of using Node.js and Go have you come across?

Anna Kozik
Business Development Manager