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 4

intermediate2 min read

Describe Go slice internals and compare to Rust slice and Vec

Go slices are three-word headers over an array; Rust &[T] is a two-word borrow without capacity; Vec<T> is an owned buffer that reallocates.

Parse a string to integer in Go and Rust with errors
intermediate2 min read

Parse a string to integer in Go and Rust with errors

This tests whether you map each language's error philosophy to syntax. Outline: Go returns (int, error) and callers check err != nil; Rust returns Result<i32, E> and callers match Ok/Err. Red flag: suggesting exceptions or ignoring Rust's must-use Result.

intermediate2 min read

Compare Go string and Rust &str/String types, mutability, UTF-8, ownership

This tests your model of immutable UTF-8 strings versus owned buffers. A strong answer contrasts Go's read-only header with Rust's &str borrow and heap-owned String, noting Go immutability is structural while Rust gates mutation via ownership.

intermediate2 min read

Compare Go's switch with Rust's match on exhaustiveness, fallthrough, and expressions.

Tests grasp of expression vs statement semantics and type safety. Go switch auto-breaks and lacks exhaustiveness; Rust match requires exhaustive patterns, forbids fallthrough, and yields values. Never say Go switch returns a value or Rust match falls through.

intermediate2 min read

Compare Go interfaces with Rust traits

This tests structural versus nominal polymorphism and API design. A strong answer contrasts Go's implicit satisfaction with Rust's explicit impl and dyn Trait. Red flag: calling one universally better without discussing coupling or backwards compatibility.

intermediate2 min read

Profiling Rust with Linux perf

perf samples CPU stacks thousands of times per second to map where your Rust binary spends time without code changes. Use it on Linux to find hot functions in a slow release build. Omitting debug symbols or frame pointers gives mangled names and broken stacks.

intermediate2 min read

Go Escape Analysis Chooses Stack Over Heap

Go escape analysis is the compiler pass that decides whether a variable lives on the stack or heap. It avoids heap allocations when data stays local, but any pointer that outlives its function escapes. The footgun is assuming small values never allocate.

intermediate2 min read

Structs: Go's Plain Memory vs Rust's Ownership

Structs bundle named fields into a custom type. Use them when tuples or maps collapse under many values. The footgun is assuming the same syntax means the same rules: Go zero-values fields silently, while Rust demands explicit initialization unless you derive…

intermediate2 min read

Primitive Scalars: Go vs Rust

Go's int grows with the architecture; Rust fixes sizes like i32 at compile time. Use Go's int for loops and Rust's i32 for counters, but both require explicit casts to mix. Assuming Go's int is 64-bit breaks 32-bit builds, and Rust's as truncates silently.

The C Application Binary Interface
intermediate2 min read

The C Application Binary Interface

An ABI is the contract a library exposes for in-process machine code access. You see this whenever a compiled program calls into a compiled library at the binary level.

intermediate2 min read

FFI Error Handling: Translation and Unwinding

FFI error handling is a translation layer: foreign errors must become Rust Results before safe code sees them, or you risk UB. You do this in -sys wrappers around C libraries. The footgun: foreign exceptions unwinding across boundary without -unwind ABI is UB.

TCP Listeners: Go vs Rust
intermediate2 min read

TCP Listeners: Go vs Rust

Go spins up TCP listeners and handles connections with lightweight goroutines—1 million costs ~500MB—but GC pauses introduce 2-5ms latency. Rust trades boilerplate for zero-cost safety and consistent sub-100µs response times without garbage collection.

intermediate2 min read

go vet: Catch Bugs Compilers Allow

go vet catches suspicious constructs the compiler ignores, like Printf argument mismatches. Run it in CI to spot concurrency and formatting bugs early. It relies on heuristics, so a clean report does not guarantee correctness and false positives can occur.

intermediate2 min read

go.mod: Root of Go Module Identity

A go.mod file anchors a Go module, declaring its canonical path and dependencies to turn a directory into a versioned unit. Every project needs one at its root, and the path dictates how others import your packages.

intermediate2 min read

The Newtype Pattern: Type Safety for Primitives

Wrap a primitive type in a new struct to give it a unique, compile-time identity. A Miles(f64) is different from a Kilometers(f64). Use it to prevent mixing up IDs or units. The footgun: you must explicitly implement or delegate methods for the new type.

intermediate2 min read

Rust's Serde: Taming JSON with Types

Serde JSON translates between human-readable JSON text and native Rust structs, acting as a bilingual interpreter for your data. Use it for web APIs or config files.

intermediate2 min read

Rust's TcpStream: Your Handle to a Network Connection

A TcpStream is Rust's handle to a network connection, closing automatically when it goes out of scope. Use it to talk to servers. The footgun: connect() can block forever; always prefer connect_timeout() in production to avoid hanging.

intermediate2 min read

Rust Enums and Pattern Matching: Type-Safe Alternatives

Rust enums define a type that can be one of several variants, each holding its own data. They're used to model states like Loading/Success/Error or handle optional values with Option<T>.

intermediate2 min read

Rust's Fearless Concurrency: Catch Bugs Before They Ship

Rust's "fearless concurrency" uses the ownership and type system to turn data races into compile-time errors. This allows you to safely use threads, message passing, or shared state without runtime surprises. The footgun is assuming this prevents all bugs.

intermediate2 min read

Rust Lifetimes: Preventing Dangling References

Lifetimes are Rust's compile-time guarantee that a reference never outlives the data it points to. The borrow checker uses them to prevent dangling pointers, a common source of bugs.

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