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 7

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.

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.

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

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.

Go Cobra: Build Complex CLIs Like `kubectl`
easy2 min read

Go Cobra: Build Complex CLIs Like `kubectl`

Cobra gives your Go CLI a command tree, like git remote add. It's for apps with nested commands and persistent flags, not just simple tools. The footgun is using it for a single command when Go's flag package would suffice.

easy2 min read

Rust's `clap`: Build CLIs by Describing Them

clap lets you define a Rust struct representing your CLI's arguments, and it generates the parser, help text, and validation. It's used for building any Rust CLI, but its feature-richness can increase binary size over simpler alternatives.

easy2 min read

The Builder Pattern: Constructing Complex Objects in Rust

The Builder pattern lets you construct complex objects step-by-step using a chain of method calls. It's crucial in Rust for structs with many optional fields, since the language lacks default arguments.

Go's Worker Pool Pattern: Capping Concurrency
intermediate2 min read

Go's Worker Pool Pattern: Capping Concurrency

A worker pool caps concurrency by using a fixed number of goroutines to process jobs from a queue. Use it for rate-limiting API calls or processing files without spawning unlimited goroutines.

intermediate2 min read

Go's Functional Options Pattern for Flexible APIs

The functional options pattern uses functions to set optional struct fields, making APIs flexible and readable. It's common for complex constructors like servers or DB clients.

intermediate2 min read

Rust's Deref Trait: Smart Pointers Acting Like Data

The Deref trait lets a "smart pointer" type act like the data it contains, making wrappers transparent. It enables calling an inner type's methods directly on a wrapper, like using &str methods on a String. Its deref() method must never fail.

Terminal User Interfaces (TUIs): GUIs for the Console
intermediate2 min read

Terminal User Interfaces (TUIs): GUIs for the Console

A TUI is a graphical interface built from text, offering rich interactivity without leaving the console. Use them for system monitoring (btop), file management, or database clients. The footgun: don't confuse them with CLIs; TUIs are stateful apps.

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

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.

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.

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.

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 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 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'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

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.

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