Verifying the Installation
To verify that Go (Golang) is installed correctly on your system, you can perform the following steps:
1. Open a Terminal/Command Prompt: Launch a terminal (macOS/Linux) or command prompt (Windows) on your computer.
2. Check Go Version: In the terminal, type the following command and press Enter:
go version
If Go is installed correctly, this command will display the installed Go version, such as go version go1.17.
3. Test a Simple Go Program: Create a simple Go program to ensure that the Go compiler is working as expected. For example, you can create a file named hello.go with the following content:
package main
import "fmt"
func main() {
fmt.Println("Hello, Go!")
}
4. Compile and Run the Program: In the terminal, navigate to the directory where you saved the hello.go file and execute the following command:
go run hello.go
If Go is set up correctly, it should compile the program and display the output:
Hello, Go!
If you see the output “Hello, Go!” after running the program, it means that Go is installed and configured properly on your system. You are now ready to start writing and running Go programs!
If you encounter any issues during the installation or verification process, double-check the installation steps or refer to the official Go documentation for troubleshooting.