My feelings about Go after spending a weekend together
Tags: programming, go, learning
Published: 2021-02-18 19:26:36

---
title: My feelings about Go after spending a weekend together
published: true
date: 2021-02-17 17:36:16 UTC
tags: programming,go,golang,learning
canonical_url: https://daveiscoding.com/2021/02/17/my-feelings-about-go-after-spending-a-weekend-together/
---

{% twitter 1361596761647820802%}

<figcaption>TLDR;</figcaption>


I had a great weekend following the [Learn Go with Tests](https://quii.gitbook.io/learn-go-with-tests/) online book. I spent about 15 hours going through the whole book and fire up a few practice projects.

I know it’s not a lot to come to a conclusion, but I had enough experience with other languages to find the pros and cons of the language. As we all know, the biggest and most exciting features of Go area the goroutines and channels. It’s built for concurrency and it’s so stupid simple to work with it.

Go comes with its own little problems. You need to pass [Context](https://faiface.github.io/post/context-should-go-away-go2/) around, down to the deepest of your call stack. At the time of this post, Go doesn’t have generics, it’s on the way though. Check out the [last blog post](https://blog.golang.org/generics-next-step) about it on Golang blog for yourself. Don’t get excited about the syntax though…

```go

// Print prints the elements of any slice.
// Print has a type parameter T and has a single (non-type)
// parameter s which is a slice of that type parameter.
func Print[T interface{}](s []T) {
	// same as above
}

```

## What’s the fuss about the syntax?

I’m a JavaScript developer who switched from C, Java, C#, PHP languages in this particular order. If you ever worked with those languages – and I bet you did -, then you know the **drill** :

```

type variableName = value;

function functionName(MyType $val) {}

public static void main(String[] args) {}

```

You know, going left to right. Type to variable name. Then Go comes to the show and…

```go

func SayHelloToThePeople(people []Person) (hellos []string) {}

```

Left to right, then right to left. Like, what in the name of Gopher is happening here?

![](https://i.kym-cdn.com/photos/images/newsfeed/001/167/690/e55.png)<figcaption>I guess you get it now</figcaption>

Maybe the problem lies in me, I should’ve gone down the route of exotic languages rather than the mainstream ones.

After all, as a full-time JS developer, I’m not sure if these two languages can live together in one _muscle_. As you get used to writing out `type variableName` then suddenly switching to `variableName []type` really twitches my _muscle memories_. Practice makes perfect though.

## Simplicity of Go

Did you know Go only has 25 keywords? We got 32 in C, 54 in Java, 54 in PHP, 59 in JavaScript, and 102 in C#. That’s according to a [mid-2017 reddit post](https://www.reddit.com/r/ProgrammerHumor/comments/6inj17/languages_by_number_of_keywords/). God knows how many keywords now C# got… Anyway, I was lazy to look it up on my own so probably those numbers are off – according to my one minute Google research C# only got 79 keywords. You still get the point, right? Go has few keywords and they managed to stuff the magic of Go – concurrency – into those few keywords.

Let’s talk about the included batteries, in my opinion that’s still something that belongs to the simplicity section. Go comes with all the fun stuff without any external dependencies. Let’s see what we got here:

- Code formatting (`gofmt`)
- Code linting (`golint`)
- More code static checks (`go vet`)
- Tests (`go test`)
- Test coverage (`go test -cover`, `go test -coverprofile=coverprofile.out`, `go tool cover`)
- An awesome standard library

If you are just starting with Go then you probably don’t need to do anything other than just installing Go. That’s a huge plus for me. Whenever I fire up a new JS project I need to go through setting up a linter, a formatter, a test runner, and many many dependencies (depends on the project though).

![](https://res.cloudinary.com/practicaldev/image/fetch/s--FqSJ910J--/c_imagga_scale,f_auto,fl_progressive,h_500,q_auto,w_1000/https://thepracticaldev.s3.amazonaws.com/i/9i6bs4g6cx05jeagfhum.png)<figcaption>I’m sure you are familiar with this</figcaption>

Our modern world of programming is very bloated I must say. I miss the good old days of just putting together a few PHP files and uploading them via FTP.

## What’s next?

Well, Go 2 is coming and I’m thrilled but scared at the same time. Hopefully Go 2 will follow what Go 1 started.

![](https://preview.redd.it/7t1p88ct13ez.jpg?width=640&crop=smart&auto=webp&s=275f5223e0e32f2d836a83824fb7cf62704ec2ff)<figcaption>Let’s hope this won’t happen. Source: <a href="https://www.reddit.com/r/golang/comments/6rxfjo/go_2_please_dont_make_it_happen/">Reddit</a></figcaption>

I’m hoping for the best regarding the future of Go. I love the current state of the language and I’ll probably continue learning it and putting together a few projects with it.