The syntax is kinda fun to learn. There is satisfaction involved in learning how a different language does things and comparing it to the others you already know. It makes me wonder how much of programming is a strong understanding of the syntax and built-in methods and such. 25%? The bigger chunk is knowing how to approach a problem and forming a solution, regardless of what the specifics of the implementation are.
It’s wild how much error-checking there is. Any given .go file has some version of this in it many times:
if err != nil {
return nil, err
}Code language: JavaScript (javascript)
This isn’t just some best practice, you have to do it otherwise the program won’t run. I don’t hate it. Gives the program some feeling of stability, even if the ritual of it is a bit much. Maybe better in some future Go?
I can return multiple values? Wild. Feels better than returning an object and then having to pluck the values out of the object like you have to do in JavaScript.
It’s so fast. I know that’s kind of the point, but wow. I’m working on this script to pull some data out of a Postgres DB, pull it apart, potentially run more queries based on what it finds, manipulate data, and put data back. I have a limited set of data for testing: 15,000 rows. It’s done in less than a second. That’s great. The complete data set it has to run on in my case is only around half a million rows, so it’ll only take a couple of seconds. I don’t even know which thing is the bottleneck, if there is one, Go or Postgres?
I’ve never really written any code in a typed language before, even TypeScript. It’s kinda nice. It’s satisfying to know exactly what kind of data is bopping around and absolutely forcing you to get it right before the program will even run at all.
The in-editor (VS Code) experience is tremendous… with the Go extension enabled. It formats your code on save (or is that Prettier?). It adds import stuff for you without having to type it at all (even removes unused imports). You can hover over just about anything for useful contextual info. It gives you red squiggles for anything that will bomb the program.
It makes me wonder: would I even like this language at all without the extreme in-editor conveniences? Am I being swayed by DX outside of the language itself?
I think I get the &pointer and *pointer stuff conceptually. Addresses that point to memory storage. Efficiencies to be had, etc. But in practice, it seems mostly used for “either this type or nil” which feels like an awkward misdirection to me somehow. In GraphQL the types either just have an ! or not which seems more to the point.
A good bit of my real-world learning practice is related to fleshing out a GraphQL API in Go, so sometimes it’s confusing which parts of this are Go-isms and which are GraphQL-isms. They both are strong on types and the syntax for both are still sometimes extremely foreign-feeling to me. I’m also doing this work in the context of CodePen which has many strong Go developers who have settled on ways of doing things, so I imagine some of this learning experience is learning specifically Go-at-CodePen conventions and techniques. For example, if I add a field to our GraphQL API, it touches quite a few files. Schemas, Resolvers, Types/Interfaces, Datastore, Mocks, etc. I think that’s good separation-of-concerns stuff, but I also think that’s how we’ve just chosen to do it. It’s my goal to understand the difference between requirements and best practices.
It seems so web-forward. There is built-in HTTP / Networking stuff. There is built-in JSON handling. There is built-in URL handling. Certainly, a language that knows it’s internet-bound. It works the other direction too, with hosting that specifically supports Go, like Lambdas. Kinda feels like… might as well write Lambdas in the fast language possible.
It’s helpful to actually do the typing. I tried to manually type my way through every example in Go By Example and do the exercises in A Tour of Go. I still haven’t finished. It’s a lot!
When you’re doing the typing in VS Code, if you’ve got GitHub Copilot on, it is seriously willing to do 90% of the typing for you. These exercises and examples must have been done so many times identically, Copilot often suggests prefilling the entire exercise. I tried not to take the suggestions too much (I should have turned it off), but it’s just so tempting usually.
I can feel the vampire of getting sucked into learning without doing. I can just sit there and stare at Go tutorials on YouTube. Junmin Lee makes some killer ones. But then I’m like… did I actually learn anything?
I’ve been trying to hit learning this like anything else I’m serious about learning:
- Read stuff
- Watch stuff
- Get mentoring from whoever I can
- Do pairing, trading off who is coding
- Write as much code as possible (hopefully as “real world” as possible also)
Just hit it from every angle possible, because no one angle is going to do it.
