Skip to content
tezvyn:

Go & Rust

Go web services, Rust backends, systems programming

69 bites

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

Advanced everything in Go & Rust, page 2

advanced2 min read

Describe Rust's orphan rule and its ecosystem purpose

State that either trait or type must be local; explain this stops conflicting foreign impls; note crates.io would see silent impl collisions breaking downstream builds.

advanced2 min read

Design a custom Go error type with context, Is, As, and Unwrap

This tests Go 1.13 error wrapping and Unwrap conventions. Answer: struct with Err and context fields; implement Error and Unwrap; note errors.Is and errors.As walk the chain. Red flag: stringifying the error via fmt.Errorf %v, which severs unwrapping.

advanced2 min read

Rust unsafe FFI vs Cgo: who owns memory safety?

Tests your grasp of where compiler guarantees end at the FFI boundary. A strong answer contrasts Rust raw-pointer validity and aliasing invariants in unsafe blocks against Cgo's automatic copying, pointer-passing restrictions, and runtime thread-switching…

advanced2 min read

Explain Rust Rc and Arc versus Go's tracing GC

This tests deterministic reference counting versus tracing GC. A strong answer contrasts Rc's heap reference counts with Go's root tracing, and notes Rc cannot reclaim cycles while Go's GC can. Red flag: claiming Rc has no cycle leak risk.

advanced2 min read

Explain Go escape analysis and Rust ownership for stack vs heap

Tests compiler-driven memory placement. Go escape analysis keeps non-escaping locals on stack, shrinking heap and GC work. Rust ownership lets the compiler pick stack or heap at build time with zero cost.

advanced3 min read

Compare enum vs trait objects for heterogeneous shapes in Rust

This tests compile-time vs run-time polymorphism in Rust. A strong answer contrasts enum's closed set, static dispatch, and stack layout against trait objects' open extensibility, heap allocation, and vtable indirection.

advanced2 min read

How does struct field ordering affect memory layout in Go and Rust?

It tests alignment, padding, and compiler layout knowledge. A strong answer explains that alignment inserts padding, Go and Rust keep declared order, and reordering by size can shrink size. Red flag: saying order is irrelevant or that compiler auto-packs.

advanced2 min read

Explain Go struct embedding vs inheritance and method promotion

What it tests: knowing Go composition and method promotion from embeds. Outline: embedding adds a type as part without is-a; promoted methods join the outer type; collisions resolve by outer-type precedence.

advanced2 min read

Shadowing in Go and Rust: idioms, bugs, and if-block scoping

Tests lexical scoping in Go and Rust. Strong answers show Go's := narrowing and Rust's let rebinding, warn that Go's if := scopes across both branches, and contrast that with Rust's block-local let. Red flag: calling shadowing mutation.

advanced2 min read

Go nil pointers vs Rust Option: impact on signatures and safety

Tests encoding of absence. Go nil means any pointer may be null, pushing checks to runtime; Rust Option<T> forces compile-time handling. Strong answers cover signatures, validity, and NPO. Red flag: calling Option syntactic sugar for null.

advanced2 min read

Default integer overflow behavior in Go versus Rust

Go wraps silently; Rust panics in debug, wraps in release; Rust has wrapping_, checked_, saturating_ methods; Go needs manual checks.

advanced2 min read

Contrast unsafe in Go versus Rust and the invariants you assume

Tests divergent safety philosophies. Go unsafe enables FFI and pointer casting; you guarantee valid memory, alignment, and GC reachability. Rust unsafe unlocks raw pointers and FFI; you manually uphold aliasing and validity invariants behind safe APIs.

advanced2 min read

CSP: Model Concurrency with Message Passing

CSP treats concurrency as isolated processes talking through channels, not threads fighting over shared memory. It shaped Go, Erlang, and occam. Engineers often retrofit shared-state patterns into channel-based code and reintroduce race conditions.

Daemonizing Go/Rust Apps: Let the OS Do It
advanced2 min read

Daemonizing Go/Rust Apps: Let the OS Do It

Daemonizing an app means running it as a background service, detached from your terminal. This is essential for web servers or job processors. The common footgun is writing custom daemon logic instead of using a system service manager like systemd.

advanced2 min read

The FromRequest Trait: Consuming Request Bodies in Axum

Axum's FromRequest trait defines how to create a type by consuming an HTTP request body. It's the core of extractors like Json<T> that deserialize POST data. The footgun: you can only use one FromRequest extractor per handler, as it consumes the body.

advanced2 min read

Rust's Tower Service: One Trait for Clients, Servers, and Middleware

Tower's Service trait is a universal API for async requests. It models any 'request -> future<response>' flow, unifying clients, servers, and middleware. Use it for HTTP servers or database clients. The footgun: ignoring poll_ready bypasses backpressure.

advanced2 min read

cbindgen: Auto-generate C/C++ Headers for Rust

cbindgen automatically generates C/C++ headers for your Rust code, saving you from writing tedious FFI boilerplate. Use it when exposing a Rust library to other languages. Its feature set is ad-hoc, so it may not support your specific edge case out of the box.

advanced2 min read

Rust's `bindgen`: Auto-Generate FFI to C/C++

bindgen is a translator that reads C/C++ headers and writes the unsafe Rust FFI code to call them. It's used to integrate Rust with existing C libraries, like system APIs or legacy code, saving you from writing bindings by hand.

advanced2 min read

Go Assembly: A Semi-Abstract Instruction Set

Go's assembler isn't a direct mapping to machine code; it's a semi-abstract instruction set. A MOV might become a clear or load. This is what you see with go tool compile -S. The footgun is assuming your assembly maps 1:1 to the final machine code.

advanced2 min read

Rust's Pin: Fixing a Value's Memory Address

Pin<P> tells the Rust compiler a value must not move from its memory location. Think of it as nailing an object to a specific spot on the memory shelf. This is crucial for self-referential types, like those in async runtimes.

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