[Golang] install and execute

2023-03-18 hit count image

Let's see how to install Golang and execute the code written by Golang.


I try to develop an web service in Golang. In this blog post, I will show you how to install Golang and execute the code written by Golang.

I’m a macOS user, so this blog post is written in macOS. If you use another OS like Windows or Linux, the command may not work.

Install Golang

There are installation guides on the Official Site for each OS.

You can use the Homebrew to install Golang if you’re a macOS user like the below.

brew install go

After installing, execute the command below to check that Golang is installed well.

go version

If you succeed to install, you will see the version like the below.

go version go1.16.6 darwin/amd64

Configure VScode

In my case, I use VSCode to develop Golang. If you use VSCode, you can install a plugin for Golang.

Open VSCode, and search the plugin and install it.

Golang VSCode plugin

Or, you can install it by executing the command below.

code --install-extension golang.go

After creating a Golang file, you can see the message on the right bottom of VSCode about installing. If you see it, just click Install All to install all for the plugin.

Hello World

Next, let’s make a simple program to print Hello World by Golang. You can see the full source code on the GitHub below.

Create a folder and make the main.go file. And, Modify it like the below to print Hello World.

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")

If you write the code, execute the command below to run the program.

go run main.go

You can see Hello, World! on the screen like the below.

Hello, World!


Done! we’ve seen how to install Golang and how to execute the program written by Golang. Next, let’s see more details about the program.

Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!

App promotion

You can use the applications that are created by this blog writer Deku.
Deku created the applications with Flutter.

If you have interested, please try to download them for free.