Rust vs Go: A Hands-On Comparison
That seems like a fair article.<p>The error handling in Go is SO verbose.
When reading my code (or even reviewing other people&#x27;s code) in order to understand at a high level what is going on, I feel like I&#x27;m squinting through a mesh wire window.<p>Compare this example in Go:<p><pre><code>    city := c.Query(&quot;city&quot;)
    latlong, err := getLatLong(city)
    if err != nil {
     c.JSON(http.StatusInternalServerError, gin.H{&quot;error&quot;: err.Error()})
     return
    }

    weather, err := getWeather(*latlong)
    if err != nil {
     c.JSON(http.StatusInternalServerError, gin.H{&quot;error&quot;: err.Error()})
     return
    }

    weatherDisplay, err := extractWeatherData(city, weather)
    if err != nil {
     c.JSON(http.StatusInternalServerError, gin.H{&quot;error&quot;: err.Error()})
     return
    }
    c.HTML(http.StatusOK, &quot;weather.html&quot;, weatherDisplay)
</code></pre>
To this code in Rust:<p><pre><code>    let lat_long = fetch_lat_long(&amp;params.city).await?;
    let weather = fetch_weather(lat_long).await?;
    let display = WeatherDisplay::new(params.city, weather);
</code></pre>
Maybe on first glance the Rust code can seem alien (what is a `?` doing there, what is actually going on with `.await`, etc) but when you are writing a 100k line application in Rust, you learn the patterns and want to be able to see the domain application logic clearly. And yet, there&#x27;s no hidden errors or exceptions. When this code fails, you will be able to clearly identify what happened and which line the error occurred on.<p>Prototyping even small applications in Go is verbose. And worse still, error prone. It&#x27;s easy to be lazy and not check for errors and oops 3 months in your code fails catastrophically.<p>I know a lot of people like Go on here but in my mind Go only makes sense as a replacement for Python (static compilation, better error handling than Python, faster etc). If you don&#x27;t know exactly what you want to build, maybe it is faster to prototype it in Go? I still would reach for Rust in those instances but that&#x27;s just me. For large applications there&#x27;s no question in my mind that Rust is a better choice.<p>Edit:<p>people have pointed out that I&#x27;m not comparing the same thing, which is true, I apologize for the confusing. But even code where Go propagates the 
errors, it is much more verbose (and my point still stands)<p><pre><code>    err := db.Get(&amp;latLong, &quot;SELECT lat, long FROM cities WHERE name = $1&quot;, name)
    if err == nil {
     return latLong, nil
    }

    latLong, err = fetchLatLong(name)
    if err != nil {
     return nil, err
    }

    err = insertCity(db, name, *latLong)
    if err != nil {
     return nil, err
    }
</code></pre>
And this is extremely common. More discussion in the thread below.