- First check the Go version by running the command
go version
- Create a folder
mkdir <folder_name>
- Switch to created folder
cd <folder_name>
- Initialize the go project by running the given command. You will get
go.mod
file.
go mod init <folder_name>
- Create a
main.go
file
notepad main.go
touch main.go
- Let's write some basic code in
main.go
file.
package main
import (
"fmt"
)
func main () {
fmt.Println("Hello From Go")
}
- Run the code by following command
go run main.go
- You will see this output in console
Hello From Go
That's for today. Thank You .
Top comments (0)