DEV Community

Cover image for Programming Languages war Golang vs Rust
Carlos Rivas
Carlos Rivas

Posted on

Programming Languages war Golang vs Rust

Install new fighters

I'm back, first if anyone miss my post I offer my apologizes, but I was without inspiration, but I'm here again with new fighters.


Ladies and gentlemen, in this corner first appeared in 2009 with memory safety, garbage collection, structural typing and is loved according to Stack Overflow 2021 by 62.74% Goooooolang

Now the next fighter had the first appeared in 2010 with memory safety without garbage collection, reference counting is optional and is loved according to Stack Overflow 2021 by 86.98% Ruuuuuuuust.

Note: Please read that like WWE or Boxing presentations.

Now we're going with the tech stuff, but remember, I don't know which is better, but I'll try to figure it out. I hope y'all enjoy this series. Obviously We have to start the installation and amazing "Hello, World!". The whole series I'm going to use SO Ubuntu, then if you need support for other SO I'm going to be here to help you.

Pre requirements

Install curl

apt install curl



This is our recipe to install Golang/Go

  • Step 1:

Download golang from the website I recommend to use curl to download the file

curl --output go1.17.3.linux-amd64.tar.gz 
Enter fullscreen mode Exit fullscreen mode


  • Step 2

Now you have to decompress the file in folder /usr/local

rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.3.linux-amd64.tar.gz

  • Step 3

Add to the file .bashrc the next line

export PATH=$PATH:/usr/local/go/bin


After that, close the shell or run

. .bashrc


If you run that and has an output, all was good

go version


  • Step 4

Create a folder and join in it

mkdir hello
cd hello/
Enter fullscreen mode Exit fullscreen mode
  • Step 5

You have to enable dependency tracking for your code

go mod init example/hello


  • Step 6

You have to create a file, can you guess the name?
Image tic tac


  package main

  import "fmt"

  func main() {
      fmt.Println("Hello, World!")
Enter fullscreen mode Exit fullscreen mode
  • Step 7

It's time to run our program

go run .



This is our recipe to install Rust

Pre requirements
Install build-essential

apt install build-essential


  • Step 1

Download the tools that you need to run the rust language from the website

curl --proto '=https' --tlsv1.2 -sSf | sh



You only require to choose the first option

And run that

source $HOME/.cargo/env


  • Step 2

This tool is called "cargo", this tool creates all structure for you and do other things, but this time only you create the structure

cargo new hello_world


By default, "cargo" creates this structure with the file to make our "Hello world!"


  fn main() {
      println!("Hello, world!");
Enter fullscreen mode Exit fullscreen mode
  • Step 3

It's time to run our program, you can guess how to?

cargo run



Entertainment fight, Golang starts with its better punch, show a simple structure, but Rust responds with fewer steps to run, Golang requires import the package "fmt" to print with "Println" something and Rust needs to use the macro Println, by the way both have the same method ending with "ln" you know why? To add a break line.


This is our first view about two amazing languages, how you could see we can use any language in so many environments for the same things, but which is better, today we can see a few conclusions:

  • Golang/Go requires more step to run.
  • Golang requires import packages to print, and Rust uses macros to the same.
  • Rust in addition to the language, install the tool "cargo" can run and create the structure base to Rust.

I hope you enjoy my post and remember that I am just a Dev like you!

Top comments (7)

lexiebkm profile image
Alexander B.K.

How both languages define methods is interesting. Being not (fully) OOP, both provide different ways in defining methods, but basically similar, i.e in the context of a type like Struct which both languages provide, and can use pointers for that purpose.
So for me, it is not a war, they are like friends to me. C/C++ too.

devlikeyou profile image
Carlos Rivas

I like your way to think, in my opinion all languages are good if you feel good with that and you can solve the problem.

lexiebkm profile image
Alexander B.K.

I am concerned with the executable file size for that simple helloworld when I use Rust, Go and C++ on Windows with the following result which is surprising to me:
Rust is 4Mb, Go is 3Mb, while C++ is only 171kb.
It seems that for a simple console app, I cannot ignore C++. That's why I want to re-learn it in the correct way.
However, these 3 languages provides Struct and Pointer that I will feel like at home when learning them all.
Currently, for web backend that uses a compiled language, my 1st option is Go because of ease and quick development. Next is Java, followed by probably C#.

devlikeyou profile image
Carlos Rivas

That's amazing, I think C ++ can't be a fighter because it would always win. Thanks for your comment.

lil5 profile image
Lucian I. Last

Very light hearted, short but nice 😊

devlikeyou profile image
Carlos Rivas

This was the first post about these languages, I will post more about them with differences and similarities. I hope you read the next post.

devlikeyou profile image
Carlos Rivas

Who won for you?