Hello World in Golang

More Golang examples

The Hello World in Golang. Here we show you an example and a brief description. This is the example you should start with always:

package main

import "fmt"

func main() {
	fmt.Println("Hello World!")
}

For run this example, first in the same path of this file, we create a module.

go mod init yourdomain.com/helloworld

To build our program and binary file we use this command:

go build

And finally, execute the binary file:

./helloworld

We can see a Hello World!

Hello World in Golang

Now you did your first Hello World with golang!

Se more: https://tour.golang.org/welcome/1