- I love golang's build toolchain. Cross-compilation is just an environment variable.
- I love its go:embed functionality, as it removes the necessity of crappy squashfs based solutions, and allows embedding all assets e.g. a webserver/website needs.
- What I both like and dislike: Marshalling. It can be a joy to use marshalling when you are in control of the data structures, but it also can be PITA when you have to parse external JSON data structures that do not conform to the same types.
Something like parsing a package.json, where fields can be e.g. a string, an array of objects or a single object is real pain to do in golang because it requires to use the reflections API.
These were the highlights for me: - Simplicity - Typed - Go-routines - Single binaries (Cross-compilation is just an environment variable)
> - Nil pointers. It would be great if there was a way to ensure points will never be nil.
Like Dart sound null safety?
Go is more similar to languages like C, where you use a * to declare a type as a pointer. So an int is just a value in the stack and cannot be null, but an *int is a pointer to somewhere in memory and can be null. It would be lovely to have a third option in this list, something like *int for non-nullable pointers and *int? for nullable pointers.
Funny, I actually think golang typing to be extremely weak and hard to use, especially with all the pointers vs non-pointer values. Typescript is by far the best type system I ever used, but even compared to Java/C#/C++ the golang types are archaic and basic, more akin to ANSI C in power
Yes the types are better than dynamic languages, but compared to modern type systems it is not very good
- gofmt. The fact that it comes with an opinionated formatter means I don't waste time with bikeshedding.
- Simplicity. I love how Go just gets out of my way and lets me do my work. I also don't need to worry about crazy abstractions and deep levels of inheritance.
- I usually don't need to worry about performance bottlenecks. Go is pretty fast.
- Typed. Over time I ended up hating languages like Python and JavaScript because of the lack of typing. Typed languages let me catch a large amount of errors at compile-time, and it also serves as documentation.
- Go-routines are a very elegant way to deal with concurrency.
- The standard library has a great selection of tools like JSON parsing that are usually not native in other languages.
- Dependency management is pretty good. Not the best, but definitely better than languages like C++.
- Single binaries. You can compile a Go application into a single binary and have it as the entry point of a container. The result are very small containers that start up very quickly.
Thing I don't like about it:
- Error handling got better over time, but it's still annoying to find out if an error is of a specific type in legacy code.
- It would be nice to have more built-ins for lists, such as .includes(), .filter(), .map(), etc.
- Nil pointers. It would be great if there was a way to ensure points will never be nil.
I was really skeptical about it at first, but it quickly became my favourite language.