Installing Go and Setting Up VS Code
Install Go, check your setup, and prepare a clean beginner-friendly workspace.
Learning objective: Install Go, verify the installation, and create a new Go module.
Installing Go
Install Go from the official Go website for your operating system. After installation, open a terminal or command prompt and check whether the go command is available.
Checking the Installation
The go version command confirms that Go is installed correctly. It displays the installed version and platform information.
Setting Up VS Code
Visual Studio Code works very well with Go. Install the Go extension to enable syntax highlighting, formatting, code completion, and debugging support.
Example Code
Create or update your Go file, then run the program using go run main.go.
go version
mkdir hello-go
cd hello-go
go mod init hello-go
Key points to remember
- A Go module helps organize your code and dependencies.
- Use one folder for each small project while learning.
- Keep filenames simple, such as main.go.
Practice Exercises
- Install Go on your computer.
- Create a new folder named hello-go.
- Run go mod init hello-go in the project folder.
Continue Learning
After this lesson, continue to the next lesson or explore related tutorials on VisualStudioTutor.com.