My feelings about Go after spending a weekend together

Full stack dev who loves to experiment, learn new things, and write stupid simple code.
Search for a command to run...

Full stack dev who loves to experiment, learn new things, and write stupid simple code.
No comments yet. Be the first to comment.
When you run your application inside a Docker container, it will be assigned process identifier (PID) 1. This particular PID is special in the Unix world. PID 1 is assigned to the very first process that the kernel starts, therefore it takes a specia...
The classic test pyramid is made up of the unit, integration, and end-to-end tests. Unit tests are supposed to run fast after each change in your IDE and give immediate feedback. In contrast, integration and E2E tests are slow and are run on-demand. ...
Monorepos are all the rage right now. Modern projects are all using NX to set up a monorepo. But why would you introduce such a complex tool into your tech stack when something simple is often enough? Both Yarn and NPM include workspace management in...
Install dependencies # Yarn yarn add -D prettier eslint-config-prettier eslint-plugin-prettier # NPM npm install -D prettier eslint-config-prettier eslint-plugin-prettier By default your eslintConfig looks like this: "eslintConfig": { "extends"...
I had a great weekend following the Learn Go with Tests online book. I spent about 15 hours going through the book and firing up a few practice projects.
I know it’s not a lot to conclude, but I had enough experience with other languages to find the pros and cons of the language. As we all know, Go’s most significant and most exciting features are the goroutines and channels. It’s built for concurrency, and it’s so stupid simple to work with it.
Go comes with its own minor problems. You need to pass Context 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 about it on Go’s blog for yourself. Don’t get excited about the syntax…
// 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
}
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 of the variable then the name of it. Then Go comes to the show and…
func SayHelloToThePeople(people []Person) (hellos []string) {}
Left to right, then right to the left. Like, what in the name of Gopher is happening here?
I guess you get it now.
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.
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. 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:
gofmt)golint)go vet)go test)go test -cover, go test -coverprofile=coverprofile.out, go tool cover)If you are just starting with Go then you probably don’t need to do anything other than just install Go. That’s a massive plus for me. Whenever I fire up a new JS project, I need to set up a linter, a formatter, a test runner, and many dependencies (depends on the project though).
I’m sure you are familiar with this.
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.
Well, Go 2 is coming, and I’m thrilled but scared at the same time. Hopefully, Go 2 will follow what Go 1 started.
I’m hoping for the best regarding the future of Go. I love the language’s current state, and I’ll probably continue learning it and putting together a few projects with it.
Let’s hope this won’t happen. Source: Reddit