Published on

Your First Hello World App with Golang

Authors

So everyone has been saying how awesome Golang is, and at this moment, I am quite curious to fiddle with it.

Golang Environment: Golang Docker Image

A quick way to get a Golang Environment, will be to use Docker. We will be using the Alpine tag:

$ docker run -it golang:alpine sh

Our Basic App

After we are in our container, lets write our first Hello World App:

app.go
package main

import "fmt"

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

Running our App:

Using golang to run our app:

$ go run app.go
Hello, World!

We can also build our app to create a executable binary:

$ go build app.go

You will find that there is a executable binary named app placed in the current working directory. Let's execute it:

$ ./app
Hello, World!

This was a very basic example, but will add more examples as I am learning the language

Resources:

Thank You

Thanks for reading, feel free to check out my website, feel free to subscribe to my newsletter or follow me at @ruanbekker on Twitter.