medium.com 3 min read Original Source

I Migrated My Go App to Rust — Here’s What Broke (and What Blew My Mind)

I spent the last two years writing and maintaining a Go backend for a moderately complex SaaS product: HTTP APIs, job queues, SQL databases, and WebSocket connections. It was reliable, simple, and productive. But curiosity (and performance envy) got the better of me. I rewrote the core of the app in Rust.

Here’s what broke, what worked, and what completely blew my mind.

1. The Learning Curve is Real

Let’s get this out of the way: migrating from Go to Rust is not plug-and-play. Rust’s steep learning curve hit me immediately — particularly ownership, lifetimes, and traits.

Here’s a simple example from the Go app:

func greet(name string) string {
    return "Hello, " + name
}
func greet(name string) string {
    return "Hello, " + name
}

The Rust equivalent looked innocent enough:

String {
format!("Hello, {}", name)
}” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>

fn greet(name: &str) -> String {
    format!("Hello, {}", name)
}
fn greet(name: &str) -> String {
    format!("Hello, {}", name)
}

But once I started dealing with data stored across threads, structs holding references, and async code, lifetimes and borrow checker errors made me slow down. A lot.

What broke: Quick iteration. Refactoring in Go was frictionless. In Rust, I often had to redesign entire data flows to appease the compiler.

2. Concurrency: Wow

Rust’s async story has matured dramatically. In Go, goroutines and channels are dead-simple and very forgiving — sometimes too forgiving.

I had a background worker queue in Go like this:

go func() {
    for job := range jobs {
        handle(job)
    }
}()
go func() {
    for job := range jobs {
        handle(job)
    }
}()

The equivalent in Rust, using tokio, looked like this:

tokio::spawn(async move {
    while let Some(job) = jobs.recv().await {
        handle(job).await;
    }
});
tokio::spawn(async move {
    while let Some(job) = jobs.recv().await {
        handle(job).await;
    }
});

What blew my mind: Rust’s Send and Sync traits force you to be thread-safe by design. I couldn’t launch a background task with shared state unless I explicitly wrapped it in Arc<Mutex<_>>, making data races basically impossible.

3. Performance: Measurable Gains

Here’s a basic benchmark parsing 1 million JSON records and inserting them into a Postgres database.

| Language | Parse & Insert Time | Peak Memory |
|----------|---------------------|-------------|
| Go       | 6.3s                | 210MB       |
| Rust     | 3.1s                | 125MB       |
| Language | Parse & Insert Time | Peak Memory |
|----------|---------------------|-------------|
| Go       | 6.3s                | 210MB       |
| Rust     | 3.1s                | 125MB       |

What blew my mind: The same code in Rust, using serde_json and sqlx, halved the execution time. And I didn’t even aggressively optimize it.

4. Ecosystem Friction

In Go, I reached for http, sql, and json from the standard library. In Rust, I had to choose between hyper, reqwest, axum, and more — all with differing compatibility and learning curves.

Here’s the Go HTTP handler:

func handler(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintln(w, "Hello, world")
}
func handler(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintln(w, "Hello, world")
}

And in Rust, using axum:

&'static str {
"Hello, world"
}” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>

async fn handler() -> &'static str {
    "Hello, world"
}
async fn handler() -> &'static str {
    "Hello, world"
}

Not bad, but getting to that point meant wiring up Router, async runtimes, and dealing with lifetimes for request guards.

What broke: Simplicity. The Go ecosystem feels boring — and that’s a feature. Rust’s ecosystem gives you power, but demands decisions and setup.

5. Error Handling is a Superpower

Rust’s Result<T, E> changed how I think about error propagation. Go’s if err != nil pattern works, but gets noisy. In Rust:

Result {
std::fs::read_to_string(path)
}” data-toggle-ms=”1200″ aria-label=”Copy code” data-nosnippet=”” class=”code-copy-btn absolute right-3 top-1/2 -translate-y-1/2 size-8 p-1.5 flex items-center justify-center bg-black/50 text-white rounded-md transition-colors duration-200 cursor-pointer hover:bg-black/70″>

fn read_file(path: &str) -> Result<String, std::io::Error> {
    std::fs::read_to_string(path)
}
fn read_file(path: &str) -> Result<String, std::io::Error> {
    std::fs::read_to_string(path)
}

The ? operator elegantly propagates errors, making error flows clear without clutter.

What blew my mind: I started using Result types even in Go-like pseudocode because they make control flow easier to reason about.

6. Compilation Time Hurts

This is no surprise. Go compiles fast. Rust compiles… eventually.

| Task               | Go (sec) | Rust (sec) |
|--------------------|----------|------------|
| Cold Build         | 1.2s     | 8.5s       |
| Incremental Change | 0.4s     | 1.9s       |
| Task               | Go (sec) | Rust (sec) |
|--------------------|----------|------------|
| Cold Build         | 1.2s     | 8.5s       |
| Incremental Change | 0.4s     | 1.9s       |

Cargo is doing a lot under the hood, and the compiler earns its keep — but when you’re used to Go’s lightning-fast builds, it feels sluggish.

What broke: My habit of frequent small tweaks. I learned to batch changes and use cargo check liberally.

7. Tooling: Surprisingly Good

Go’s tooling is famously solid: go fmt, go test, go build, and it just works.

Rust surprised me here.

  • cargo fmt, cargo clippy, and cargo check are top-tier.
  • cargo audit for supply chain security.
  • cargo bench for integrated benchmarking.

Here’s a snippet from a simple benchmark using criterion in Rust:

fn my_function() {
    // logic here
}

criterion_group!(benches, |b| {
    b.bench_function("my_function", |b| b.iter(|| my_function()));
});
fn my_function() {
    // logic here
}

criterion_group!(benches, |b| {
    b.bench_function("my_function", |b| b.iter(|| my_function()));
});

What blew my mind: The quality and depth of Rust tooling is phenomenal, even for a young ecosystem.

Final Verdict

Was it worth it? Absolutely — but not for every project.

When Go still wins:

  • Rapid prototyping
  • Simple microservices
  • Developer onboarding
  • When compilation time matters

When Rust shines:

  • High-performance backends
  • Memory-sensitive workloads
  • Safety-critical systems
  • Anything where you don’t want to rely on runtime checks

Takeaways

Migrating from Go to Rust wasn’t a clean port — it was a rethinking. I had to unlearn habits, embrace constraints, and fight the compiler. But the payoff was massive in performance, safety, and long-term maintainability.

If you’re considering a similar migration, be prepared for friction. But also prepare to be amazed.

Rust doesn’t just ask you to write code — it asks you to design software like you mean it.