Skip to content
tezvyn:

Go & Rust

Go web services, Rust backends, systems programming

133 bites

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

Intermediate everything in Go & Rust, page 6

intermediate2 min read

cargo doc: Turn Code Comments into a Website

cargo doc turns your Rust doc comments into a searchable HTML website for your crate and its dependencies. Use it to generate a local API reference or explore a dependency's API.

intermediate2 min read

Go's Race Detector: Find Concurrency Bugs at Runtime

The Go race detector finds data races by watching memory access at runtime. Use go test -race in CI or on a canary instance, but remember: it only catches races that actually execute. If your tests don't trigger the race, it won't be found.

intermediate2 min read

Go Benchmarking: Measure, Don't Guess

Go's benchmark runner finds stable performance numbers by repeatedly calling your code in a loop controlled by b.N. Use it to optimize hot paths or compare algorithm implementations. Forgetting b.ResetTimer() will include setup costs, skewing your results.

intermediate2 min read

Cargo Clippy: Your Opinionated Rust Code Reviewer

cargo clippy is an automated code reviewer that goes beyond the compiler, catching subtle bugs, performance issues, and style violations. Run it in CI to enforce idiomatic Rust.

intermediate2 min read

cargo add: Stop Editing Cargo.toml By Hand

Stop editing Cargo.toml by hand. cargo add lets you add, remove, and modify Rust dependencies from the command line. Use it to pull crates from registries, git repos, or local paths.

intermediate2 min read

Rust's `std::sync::Mutex`: Guarding Shared Data

A Rust Mutex guards shared data, granting access only via a temporary RAII "guard" that auto-releases the lock. It's used inside an Arc for safe multi-threaded mutation.

intermediate2 min read

Rust Async Runtimes: The Engine for `async/await`

Rust's async/await is just syntax; an async runtime like Tokio is the engine that runs the code. It polls Futures until they complete, managing I/O and scheduling. This is essential for web servers.

intermediate2 min read

Rust's async/await: Cooperative Concurrency

Rust's async/await is cooperative concurrency, where tasks explicitly yield control with .await. This is ideal for I/O-bound work like managing thousands of network connections. The biggest footgun: calling an async function without .await does nothing.

intermediate2 min read

Go Channels: Buffered vs. Unbuffered

Unbuffered channels are a synchronous rendezvous, blocking until both sender and receiver are ready. Buffered channels are an async mailbox, letting senders drop messages and go. The footgun is using a buffer to hide a deadlock instead of fixing it.

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.

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

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.

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

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.

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.

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.

intermediate2 min read

RAII in Rust: Automatic Cleanup via Scope

RAII ties a resource's lifetime to its owner's scope. When the owner variable is dropped, Rust automatically cleans up the resource, preventing leaks. This applies to heap memory, file handles, and locks. The footgun: cleanup is deterministic, not like a GC.

intermediate2 min read

Rust's `Drop` Trait: Automatic Resource Cleanup

Rust's Drop trait provides automatic, deterministic cleanup, like a destructor. It's used to release external resources like file handles or network sockets when a value goes out of scope. The key footgun: you cannot implement Drop on a Copy type.

intermediate2 min read

Rust's Module-to-Filesystem Mapping

Rust's module system maps directly to your file system. A mod foo; statement tells the compiler to look for foo.rs or foo/mod.rs. This is how you organize any multi-file Rust project.

intermediate2 min read

Cargo.toml: Rust's Project Recipe

Cargo.toml is your Rust project's recipe, telling the compiler what to build and what dependencies it needs. It defines metadata, production dependencies, and dev-only dependencies for testing.

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