Golang makes it easy to compile and run a go program using the command go run filename.go
Once you have installed Go, you can create a new file with a .go extension. If you want to install Go, you can follow the official docs here
Create a new file called firstprogram.go
(You can have any name here to represent your project)
Add the following code to the file
package main
import "fmt"
func main() {
fmt.Println("This is my first program in Go")
}
Run the command go run firstprogram.go
Output of the command
This is my first program in Go
go run <filename>.go
We will reach out when exciting new posts are available. We won’t send you spam. Unsubscribe at any time.