GoLang Flashcards
Concurrency
Go has built-in support for concurrency through goroutines and channels, which make it easy to write concurrent programs.
Unlike traditional threading models, goroutines are lightweight and managed by the Go runtime, making it efficient to spawn thousands of them.
Channels provide a safe way for goroutines to communicate and synchronize data.
Static Typing with Type Inference
Go is statically typed, meaning variables have predefined types that cannot change.
However, Go also features type inference, allowing developers to omit the type when declaring variables if it can be inferred from the assigned value.
Garbage Collection
Go has automatic memory management via garbage collection, which helps prevent memory leaks and simplifies memory management for developers.
Garbage collection in Go is concurrent, meaning it can run concurrently with the application, reducing pause times.
Error Handling
Go favors explicit error handling rather than exceptions.
Functions typically return error values alongside the result, and it’s common to check for errors immediately after function calls.
Go’s approach to error handling encourages developers to handle errors explicitly, leading to more robust and predictable code
Simplicity and Minimalism
Go follows a minimalist design philosophy, favoring simplicity and readability.
It has a relatively small standard library compared to some other languages, but it’s designed to be comprehensive and efficient.
Cross-Platform Support
Go is designed to be cross-platform, with compilers available for various operating systems and architectures.
This makes it easy to write Go programs that can run on different platforms without modification.