Basics of Go

Philosophy & Tools

Maximiliano Firtman

Maximiliano Firtman

Independent Consultant
Basics of Go

Check out a free preview of the full Basics of Go course

The "Philosophy & Tools" Lesson is part of the full, Basics of Go course featured in this preview video. Here's what you'd learn in this lesson:

Maximiliano explores companies that use Go and the main values of the language. The discussion also covers the capabilities of the Go CLI and the tooling required for developing Go applications.


Transcript from the "Philosophy & Tools" Lesson

>> So Netflix, Google, PayPal, American Express, Twitch, Twitter, a lot of companies are using or moving into Go. For which parts? For the backend? It depends, typically for services, microservices, web services. Sometimes the web services are still Node.js, but there is still another part of the process that is Go, they're are moving parts individually or they start a new project and they start that project using Go.

So it depends, because it's multipurpose, you can even do frontend with Go if you want to. I'm not saying that it's a good idea, or that we have a lot of websites created in Go, but it's possible, okay? So, before actually coding, value and philosophy around the language.

Simplicity, we already mentioned that. It's a language that knows the existence of network requests and concurrency execution. So, from scratch we know that we will use a network. So, it's part of the core that we can make a HTTP request or we can parse JSON. We don't need an additional library.

It's not like a hack or something that they have added, no, it's part of the deal. The same with concurrent execution because we are going to download things that takes time. We can do several things in parallel. So from scratch, they thought about how we can solve the problem.

So when you were asking about if we are going to cover concurrency, we are going to do that and we're going to see how different it is from other languages. So doing threading, so executing several tasks at the same time is completely different from Java, or from other languages, or even from JavaScript.

And it's much simpler, it's actually pretty simple to make it work. So, we are going to be library free, so Bonilla Go if you want for string manipulation, network, compression, and file management testing, that's also pretty cool. We don't need to use an external testing library, the basics of testing are there.

Again, disclaimer, everything is under the three goals, okay? Simplicity, efficiency and execution, efficiency and compilation. So I'm saying this because maybe you will see how testing is done, at first you won't like. The reason is always because we wanna keep those three goals. If you are new to programming, maybe you will like it.

But if you are used to a different paradigm, you are expecting to continue that paradigm in Go, and that won't be possible. You need to adapt to Go paradigm. That's why also there is a lot of hate on Go, it's not just love. That are typically developer from other languages and they didn't actually shaped a lot of Go so far, they hate the language, they hate that lack of freedom.

We don't have enough freedom in the language. You understand what I mean in a second. Well, it's called cross-platform backwards compatibility, we have already mentioned that. And it has a powerful command line interface to actually do everything we need. That compared with other languages also, we don't need to do a lot of stuff.

You will see it's simple as the language, okay? So that's the Go CLI, we are not going to go one by one right now. We're going to do directly this with code, but you can initialize the project. You can build from that, you can test. Again, you don't need the test runner, you can just use the Go CLI to run your test.

Of course, that visual studio code or all the IDs are integrated with the CLI. So, you will get your standard experience in your IDE. Documentation, so you can generate the documentation and you can read the documentation from the CLI. Well, sometimes it's pretty cool. So if you have a question instead of using Google, you can open the terminal and you can ask the CLI about a function within a package, okay?

Again, if you're using an ID, it's going to be integrated that there, but it's cool to have. So for the tools that we need today, as I mentioned before, we need to download Go, the Go runtime. It's including the CLI, so we don't need to download the Go CLI apart.

I'm going to use Visual Studio Code because it has the better Plugins that we are going to use, but if you like other IDE, go ahead. There is an official Plugin for Go in theVisual Studio Code Plugin Library, I will show you which one it is. And that plugin, the first time you open a .go file, will ask you to download additional tools that includes a linter.

Do you know what a linter is? No, you wanna-
>> Something that cleans up common code syntax and small errors.
>> Well, actually the lidar, is not cleaning up anything
>> Point out.
>> It's pointing out that, yeah, you might have a problem there. So some people has a confusion between the compiler and the linter.

The linter is not a compiler, it's at the static analysis. That is analyzing your code and is finding bad practices if you want, or problems that you might have, or it's going to highlight design patterns or start guidelines that you're not following. For example, if something needs to start with a capital letter and you're not doing that, it will give you a warning, that's a linter.

Maybe it compiles anyway, but you're not following the rules that the linter will complain. So we will see the linter in action, okay? But in this case, the VS Code plugin will download everything from us.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now