Leveraging the Go Ecosystem

We're going to take a look at two primary aspects of the Go ecosystem that you might find valuable.

1. Development Tools

There are a wide variety of development environments that are used to develop Go code, including Visual Studio Code by Microsoft, GoLand by JetBrains, Vim, Emacs, Eclipse, and many, many more.

How do all of these tools work?
When Go was first being developed, all of these tools became reliant upon a collection of third‑party community projects that supplied different bits of functionality. So we might use one project that provided auto complete functionality, another one that provided certain refactoring support, another one that automatically imported those packages for us. Well, as you can imagine, over time, that becomes a fairly complicated ecosystem, and managing all those projects became difficult. And so a few years ago, a project was created to unify the development experience regardless of editors, and that project is called Gopls. This Go language service is rapidly becoming the underpinning technology that no matter what tool you use, no matter what editor you use, you have exactly the same features available to you because those features are now provided by Gopls, and Gopls is actually maintained by the Go core team.

Which are the most popular?
You will often find is that Visual Studio Code and GoLand are often the top choices. Visual Studio Code is the most popular editor for Go code right now, and it is arguably the best free tool that's out there. There's no charge for Visual Studio Code. There's no charge for Gopls, and there's no charge for the extension that allows Visual Studio Code to work with Gopls.
GoLand is arguably the best development environment that's out there. However, it does have a premium associated with it because it is a product sold by JetBrains. So what we often find is professional Go developers often used GoLand, and developers that are using Go amongst other languages often use Visual Studio Code.

But no matter what editor you pick, you're going to get a very high‑level experience because all the functionality is really being supported in the background by that Go language service.

Development Tools

2. Common Frameworks

To answer the question about what frameworks you might want to look for, I want to go back and talk about what are the primary use cases for Go? we saw in previous post that there were three.We talked about cloud and network services, command‑line interfaces, and cloud infrastructure. Now, each one of these has a set of frameworks that you might find valuable.

Common Frameworks – Network Services

If we look at network services, for example, we see that there are a few top choices that are out there.
1. Microservice
Go kit is a comprehensive microservice framework. So if you're building a distributed system that's based on Go, Go kit is an excellent choice to look for. So Go kit provides not just the microservices, but the integration of those services. So if you're looking for a framework that's going to allow you to manage all of the common interests of your microservice infrastructure together, Go kit is a good choice to look at.
2. Web framework, - web services or web applications
If you're looking for a web framework, either for web services or web applications, then Gin is a very popular choice. Gin is a very fast, lightweight web framework that focuses primarily on the routing of your requests to your request handlers. You're going to write all of your business logic in your data integration layer, but Gin is going to provide that critical connection between the requests that are coming in and the handlers that actually handle those requests. It also has an extensive API for generating different types of results. So it makes generating JSON messages or XML or CSV or any type of data format that you might need to produce, it makes it very, very simple to work with all of those different data formats.
3. Toolkit
If you're looking for something even lighter weight, then I would encourage you to look at the Gorilla toolkit. The Gorilla toolkit isn't really a framework, it's what I would call a toolkit. So, where the framework provides the structure that you write your application within, a toolkit allows you to define the structure, and then you pull in the different tools as you require it. Gorilla has a set of interoperating, but independent tools that you can select for, for example, routing or URL creation or session management. Or if you're working with a web application, you can even manage web sockets on the server side using one of the Gorilla toolkit modules.
CommonFrameworks–Network Services.PNG

Command‑line interfaces

For command‑line interfaces you can select among following
1. Cobra
Cobra is a framework that allows you to manage command‑line applications. This is a very high‑level tool that allows very, very sophisticated CLIs to be built together in a very modular way. So if you're interested in a command‑line application or a suite of command‑line applications, then this is a tool that you might want to look at.
2. Standard library
The standard library provides a zero‑dependency solution for managing command‑line applications. What we find with the standard library with Go is it provides a lot of default functionality that we need in CLIs, as well as web services and other common application types so that you don't need to manage dependencies as well. So if your application requires interacting with the command line, but you don't need the sophistication that Cobra provides, then the standard library might be a good choice for you to investigate.
Command‑line-interfaces.PNG

Cloud infrastructure

1. Docker
Docker is one of the original container management systems, and we see that Docker is actually written in Go. So, if we want to extend Docker at all, then you're going to end up working with it in the Go language.
2. Kubernetes
Kubernetes is a platform that allows us to manage containers in a production environment. So it allows us to deploy and scale containerized applications easily. So if you need something for that, then Kubernetes is definitely the premier choice in the world today.
3. Terraform
The Terraform project allows us to manage infrastructure as a set of configurations. So we can configure our desired state of our infrastructure, and then Terraform will reconfigure our cloud infrastructure to match that updated configuration. So that, once again, is written in Go, and so that just lends support.
Any time you're working with cloud infrastructure, the chances are you're going to be working with the Go language, so it's an excellent tool to use, especially if you're going to be interacting with these systems and might need to extend them.
Cloud-infrastructure.PNG