Skip to content
tezvyn:

Go & Rust

Go web services, Rust backends, systems programming

144 bites

Test yourself: Top 30 Go & Rust concepts questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Concepts in Go & Rust, page 3

intermediate2 min read

Rust's Lifetime Elision: When You Can Skip 'a

Lifetime elision lets you omit explicit lifetimes ('a) in function signatures. The compiler infers them from common patterns, like a function taking one reference and returning one.

GC vs. Ownership: Two Paths to Memory Safety
intermediate2 min read

GC vs. Ownership: Two Paths to Memory Safety

Rust's ownership model provides memory safety at compile-time, aiming for C++-level performance without a garbage collector. This makes it ideal for systems programming where resource control is key. The footgun is assuming all "safe" languages are equal.

advanced2 min read

Go's GC: Low-Latency Collection with Tri-color Marking

Go's GC uses a tri-color algorithm to find unused memory concurrently, avoiding long pauses. It's crucial for low-latency services. The main footgun is breaking the invariant: a 'finished' (black) object must never point to a new (white) one without notifying…

advanced2 min read

Rust's Interior Mutability: Mutating 'Immutable' Data

Interior mutability lets you modify data through an immutable reference, moving Rust's borrow checks from compile-time to runtime. It's used in single-threaded code when the compiler can't verify safe access.

advanced2 min read

Rust's NLL: Smarter Borrows Based on Use, Not Scope

Non-Lexical Lifetimes (NLL) make Rust's borrow checker smarter. A borrow's lifetime ends after its last use, not at the end of its code block. This allows modifying data after a borrow is finished, even if the reference variable is still in scope.

easy2 min read

Go's `error` Interface: Errors Are Values

In Go, an error is any value that can describe its own failure string. Functions like os.Open return an error to signal problems. The footgun is only checking for nil and ignoring the rich, structured data a custom error type can provide.

easy2 min read

Rust's Option<T>: Handling Absence Safely

Rust's Option<T> is a type-safe box that holds either a value (Some(T)) or nothing (None), eliminating null pointer errors. Use it for function returns that might fail or for optional struct fields. The footgun is .unwrap(), which panics on None.

easy2 min read

Handling Errors with Rust's Result Enum

Rust's Result enum makes error handling explicit. Instead of returning a value that might be an error code, functions return either Ok(value) or Err(error). It's used for recoverable failures like I/O.

intermediate2 min read

Go Error Wrapping: Preserving Context, Not Just Text

Go's error wrapping adds context without losing the original error's type. Use fmt.Errorf with %w to create a chain of errors, then inspect it with errors.Is or errors.As. The footgun is using %v, which just formats the error as a string.

intermediate2 min read

Rust's Question Mark Operator (?): Propagate Errors, Not Boilerplate

The ? operator cleans up Rust error handling by propagating Err values. Instead of a verbose match block, you append ? to a Result or Option, and it automatically returns the error if present, letting you focus on the happy path.

intermediate2 min read

Result: Handling Recoverable Errors in Rust

Rust handles recoverable errors with the Result<T, E> enum, forcing you to deal with both success (Ok) and failure (Err) paths. This shows up when a function like File::open might fail.

advanced2 min read

Go's Panic/Recover: For Exceptional Errors Only

Go's panic/recover is a last-resort error mechanism, not a try/catch replacement. A panic unwinds a goroutine's stack until a recover in a defer'd function catches it. It's used to keep a server alive when one request fails catastrophically.

advanced2 min read

Rust's `panic!`: When to Crash Your Program Intentionally

Rust's panic! is an emergency stop for unrecoverable bugs, intentionally crashing the current thread. It's for impossible states where continuing is dangerous, not for recoverable errors like failed I/O—use Result for that.

advanced2 min read

Composable Error Types with `thiserror` in Rust

thiserror generates boilerplate for custom Rust error types, letting you define specific, matchable errors for a library. Use it when callers need to handle different failure modes. The footgun is using it for simple app errors where anyhow would suffice.

easy1 min read

Implicit Interface Satisfaction in Go

Go types satisfy an interface automatically by having the right methods, with no explicit implements declaration. This structural typing decouples implementations from interface definitions, so you can define interfaces around how you use a type without…

intermediate2 min read

Static Dispatch: Zero-Cost Abstraction via Monomorphization

Static dispatch resolves function calls at compile time, avoiding runtime overhead. Rust does this via monomorphization, creating specialized code for each concrete type. This is the default for generics, but the trade-off is larger binary sizes.

intermediate2 min read

Rust's `impl Trait`: Hiding Concrete Types

Rust's impl Trait specifies a type by its behavior, not its name. Use it in function arguments for cleaner generics (fn f(x: impl Debug)) or in return types to hide complex types like closures and iterators, avoiding heap allocation.

advanced2 min read

Rust Associated Types: One Trait, One Concrete Type

Associated types link a placeholder type to a trait, ensuring any implementation provides one specific type. This cleans up code, like in Rust's Iterator trait. The footgun: a type can only implement a trait with an associated type once.

advanced2 min read

Rust Marker Traits: Properties as Types

Marker traits are empty labels telling the Rust compiler about a type's capabilities, like being copyable or thread-safe. They have no methods; their presence is the signal. They're key for concurrency (Send/Sync) and memory (Copy/Sized) safety checks.

easy2 min read

Rust's std::thread::spawn: Create and Manage OS Threads

std::thread::spawn creates a new OS thread to run code concurrently, returning a JoinHandle to wait for completion. Use it for background tasks or parallel computations. The footgun: dropping the handle detaches the thread, risking resource leaks.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles