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 5

advanced2 min read

Rust Build Profiles: Tune for Speed vs. Debugging

Rust build profiles are presets for the compiler, trading off compile time and debuggability for runtime speed. Use the dev profile for quick iteration and the release profile for production. The footgun is benchmarking without the --release flag.

easy2 min read

Go's `os` Package: Your File System Toolkit

Go's os package is your universal remote for the file system. Use ReadFile for quick access or open a File object for finer control. It's essential for logs and configs. Forgetting to Close() a file leaks resources and can crash your program.

easy2 min read

Go-Style vs. GNU-Style Flag Parsing

Go's command-line parser is stricter than the familiar GNU style, not distinguishing short/long flags or allowing them after arguments. This is key when porting Go CLIs to Rust to maintain user experience.

easy2 min read

Go's Time: Wall Clocks vs. Monotonic Clocks

Go separates telling time (wall clock) from measuring it (monotonic clock) to prevent errors from system clock changes. Use time.Sub for reliable timing and time.Format for display. The footgun: formatting uses a magic date, not YYYY-MM-DD.

Go vs. Rust: Why String Indexing Is Tricky
easy2 min read

Go vs. Rust: Why String Indexing Is Tricky

Rust prevents direct string indexing to force correctness, while Go treats strings as raw byte slices. This matters for non-ASCII text where characters span multiple bytes. The footgun: Go's s[i] can corrupt data; Rust's &s[..i] can panic.

Buffered I/O: Batch System Calls for Speed
intermediate2 min read

Buffered I/O: Batch System Calls for Speed

Buffered I/O batches many small reads or writes into fewer, larger system calls, trading a small amount of memory for a huge speed boost. It's essential for tasks like writing log files line-by-line, preventing a system call for every single line.

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's `net/http`: A Production-Ready Web Server

Go's net/http package provides a powerful, production-ready web server without external frameworks. You build services by creating handlers—functions that process a request and write a response. It's ideal for APIs and microservices.

intermediate2 min read

Regex Engines: Backtracking vs. Finite Automata

A backtracking regex engine tries one path at a time, which can be fast but also exponentially slow. A finite-automata engine (like Go's) checks all paths at once, guaranteeing linear time. The footgun is using a backtracking engine on untrusted user input.

advanced1 min read

I/O Stream Abstractions

I/O stream abstractions like Go's io.Reader and io.Writer model data as a flow of bytes behind a tiny interface, so files, sockets, buffers and encoders compose interchangeably without each one knowing the others' concrete type.

advanced2 min read

Go's `context` Package: Propagating Cancellation and Deadlines

Go's context package is a lifeline for requests, carrying cancellation signals, deadlines, and values across function calls and goroutines. It's essential for I/O-bound operations to prevent resource leaks.

advanced2 min read

Foreign Function Interface (FFI): Calling Other Languages

Think of an FFI as a universal adapter, letting your program call functions written in another language. It's how modern code in Rust or Go can reuse battle-tested C libraries for tasks like graphics or system calls, avoiding a complete rewrite.

easy2 min read

Go Table-Driven Tests: Test More with Less Code

Instead of copy-pasting tests, define inputs and expected outputs in a table (a slice or map) and loop through them. This is the idiomatic Go way to test functions with many edge cases. The main footgun is a closure bug in parallel tests; re-shadow the.

easy2 min read

Rust Unit Tests: Co-locating Tests with Code

In Rust, unit tests live inside a special tests module within the same file as the code they're testing. This lets you test a module in isolation, including its private functions.

easy2 min read

Rust Doctests

Rust doctests are code examples written inside documentation comments that the compiler extracts, compiles and runs as real tests, so your documentation's example code is guaranteed to keep working instead of silently rotting out of date.

easy2 min read

Go Test Coverage: Rewriting Source to See What's Untested

Go's coverage tool rewrites your source code, adding counters to see what's executed during tests. It's a powerful way to find untested code, but remember: high coverage doesn't guarantee your tests are actually checking for correctness.

intermediate2 min read

Mocking in Go: Swap Real Code for Test Doubles

Mocking in Go uses interfaces to swap slow dependencies like time.Sleep with fast fakes in tests, keeping your test suite quick. Use it for network calls or database access. The footgun is testing implementation details instead of observable behavior.

intermediate2 min read

Go's pprof: Finding Your Code's Hotspots

pprof is a heat map for your code, revealing which functions consume the most CPU. It samples your program's call stacks to find performance hotspots. Use it to diagnose slow API endpoints or high-CPU background jobs. The footgun: profiling under no load.

intermediate2 min read

Go Memory Profiling with pprof

pprof takes a snapshot of your Go app's memory usage, showing which functions allocate the most. Use it to diagnose high memory consumption or find leaks. A common footgun is profiling total allocations (allocs) instead of current memory use (heap).

intermediate2 min read

Criterion: Statistical Benchmarking for Rust

Criterion isn't just a stopwatch; it's a statistical lab for your code. It provides stable performance metrics by running functions many times, letting you detect regressions and prove optimizations. The footgun is ignoring its statistical reports.

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