Create and Run a Go Project
In this tutorial, you will learn how to create and run a sample project in Go programming language.
- Create a new folder with the name of your choice using a terminal/command prompt:
- Launch Visual Studio Code IDE and add this project folder to the project explorer.
- Create a file with .go extension inside your newly created project folder. Example:
- If it is your first time creating a Go project on Visual Studio Code, then it will prompt you to install Go extentions like shown in the image below:
- Choose Install All.
- Now, write the following code in your sample.go project file.
- Run your project with following command via Visual Studio Code terminal:
mkdir project_name


package main
import "fmt"
func main() {
fmt.Println("Hello world")
}
go run sample.go

The above command should print something like below:
Hello world
Congratulations, you have learned how to create and run a project in Go programming language.