Getting started with Go-Lang
Tags: go, github, tutorial
Published: 2021-12-24 09:43:46

Been looking into go-lang this past month and decided to give it a go.
this is tutorial i will take you through the different steps i took to setup the go-lang development environment on my pc.

the first step I recommend  is to use GVM, GVM is the Go Version Manager.
To install GVM type in the following command in your terminal.

`

```
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
```

if you are  using zsh instead of bash you can use the following command.

```
zsh < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
```

once installed you can later check the available commands it comes with by entering the following command in your terminal.

`$ gvm`

below are some of the few it will display on your screen.

`

```
$ gvm
Usage: gvm [command]

Description:
  GVM is the Go Version Manager

Commands:
  version    - print the gvm version number
  get        - gets the latest code (for debugging)
  use        - select a go version to use (--default to set permanently)
  diff       - view changes to Go root
  help       - display this usage text
  implode    - completely remove gvm
  install    - install go versions
  uninstall  - uninstall go versions
  cross      - install go cross compilers
  linkthis   - link this directory into GOPATH
  list       - list installed go versions
  listall    - list available versions
  alias      - manage go version aliases
  pkgset     - manage go packages sets
  pkgenv     - edit the environment for a package set
```
`
`

Once gvm is installed, you can proceed to restart your terminal so it can get activated, since i was using bash i used the following command to restart my terminal.

`$ exec bash -l`

on restart, you can check the gvm version using the following command.

`

```
$ gvm version
```
Go Version Manager v1.0.22 installed
`

you can also set the environment variables using the following commands.

```
$ [[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
$ export GOPATH=$HOME/go
$ export GOBIN=$GOPATH/bin
$ export PATH=${PATH}:$GOBIN:$GOROOT/bin
```

this will set set your $GOROOT and $GOPATH environment variables.

you can restart your terminal again to proceed with the following steps smoothly.

You can proceed to install go using the following gvm command.
`gvm install go1.17.5`

At the time of this article was written that was the latest version go released. To check for other go version releases follow this link. [](https://golang.org/doc/install)

Once go is installed. you can use this command to check for the version installed and also verify the installation.

`$ go version`

Go as a programming language has a wide range of applicability, it was originally built for programs related to networking and infrastructure. It was intended to replace popular high-performance server-side languages like Java and C++. Today, Go is used for a variety of applications like cloud and server side applications, DevOps, command line tools and much more.

in future articles i will demonstrate how to create applications in go.

thanks for reading 😊