How to set up Golang in Manjaro Linux
Tags: go, linux, beginners, tutorial
Published: 2019-11-11 01:59:54

---
title: How to set up Golang in Manjaro Linux
published: true
description: How to set up your Manjaro environment to do Golang development
tags: golang, linux, beginner, tutorial
canonical_url: https://www.jeremymorgan.com/tutorials/golang/golang-manjaro-linux/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/6y93et3biugawwvy3h0z.jpg
---

Today we're going to set up a Golang development environment in [Manjaro Linux](http://bit.ly/GetManjaro). It's super easy. 

I've been playing around with Manjaro a lot lately and it's a pretty cool distribution, it's based off Arch Linux, which I'm a huge fan of. 

## Step 1: Update the System

![Golang on Manjaro](https://thepracticaldev.s3.amazonaws.com/i/k1hwsdghquq8hxznyari.jpg)

At your Manjaro desktop, open a command prompt. The first thing you'll want to do is update the system. 

We do that by typing in 

```
sudo pacman -Syu
```

This will make sure your system is up to date. 

## Install Golang

Next, install Golang 

Type in 

```
sudo pacman -S go 
```

you can verify it's installed by typing in:

```
go version
```

![Golang on Manjaro](https://thepracticaldev.s3.amazonaws.com/i/m6sxu6qi183uzpdrr0pk.jpg)

So now I'm going to create a projects folder (/home/jeremy/Projects) and create a hello world to test this out.   
  
Create a file named hello.go and put in the hello world code:

```
package main
import "fmt"
func main() {
    fmt.Println("hello world")
}
```

Save the file, and then build it with the following command: 

``` 
go build hello.go
``` 

This will build an executable you can run named "hello"

if you run it, it should output your message:

![Golang on Manjaro](https://thepracticaldev.s3.amazonaws.com/i/qinofjvaktuvaxn740cb.jpg)

## Install Visual Studio Code

Now the Version of Visual Studio code that I want is in the [AUR](https://aur.archlinux.org/packages/visual-studio-code-bin/?O=10&PP=10). So we'll install git. 

```
sudo pacman -S git 
```

I like to create a sources folder for building AURs(/home/jeremy/Sources) but you can put it where you want. To run AURs you must clone or download them first. 

I will go back to the AUR page and copy the git clone url and clone it:

```
git clone https://aur.archlinux.org/packages/visual-studio-code-bin/?O=10&PP=10
```

Next, run 
```
makepkg -i
```

![Golang on Manjaro](https://thepracticaldev.s3.amazonaws.com/i/93a3jum8w6f60smxfksv.jpg)

I'm getting this error, and you might too because this is a brand new Manjaro install so I haven't installed the tools yet to make AUR packages. 

To build AURs you'll have to install some tools: 

Type in 

```
pacman -S base-devel
``` 
And you can choose 3 for bin utils, or enter for all. I'm going to install all because I'll be building a lot of things on this machine. 

Now run

```
makepkg -i
```

![Golang on Manjaro](https://thepracticaldev.s3.amazonaws.com/i/t9je9bj300gm2hfe8421.jpg)

And we're back in business. 

### Start Coding! 

We load up visual studio code and now I'll go back to that projects folder. 

It recommends the go extension so we'll go ahead and install it. 

As you can see it recommends we install go outline. 

We will just click on install all, and it will build in the dependencies we need. 


![Golang on Manjaro](https://thepracticaldev.s3.amazonaws.com/i/er4rjbgdgvcnj4jirqb5.jpg)

Now this is all set up for us, it's super easy. 

We can even run and debug the file. 

Now I've put some simple code here to add a couple of numbers. 

I'll add in a breakpoint and run it. 

So it's that easy to set up a go development environment in Manjaro. It's simple and easy, so have fun and get to coding!!

Here's a video covering this:   

{% youtube VPnBYtB6sbg %}

If you'd like to learn more about Golang, check out [Pluralsight's courses on Golang](http://bit.ly/PSGolangCourses) today, there are tons of great courses to get you ramped up fast.