go

Simple Project Setup in Go - 01

anuragaffection

Anurag Affection

Posted on May 16, 2024

Simple Project Setup in Go - 01
  • First check the Go version by running the command
go version
Enter fullscreen mode Exit fullscreen mode
  • Create a folder
mkdir <folder_name>
Enter fullscreen mode Exit fullscreen mode
  • Switch to created folder
cd <folder_name>
Enter fullscreen mode Exit fullscreen mode
  • Initialize the go project by running the given command. You will get go.mod file.
go mod init <folder_name>
Enter fullscreen mode Exit fullscreen mode
  • Create a main.go file
notepad main.go 
touch main.go
Enter fullscreen mode Exit fullscreen mode
  • Let's write some basic code in main.go file.
package main 

import (
    "fmt"
)


func main () {
    fmt.Println("Hello From Go")
}

Enter fullscreen mode Exit fullscreen mode
  • Run the code by following command
go run main.go 
Enter fullscreen mode Exit fullscreen mode
  • You will see this output in console
Hello From Go
Enter fullscreen mode Exit fullscreen mode

That's for today. Thank You .

💖 💪 🙅 🚩
anuragaffection
Anurag Affection

Posted on May 16, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related