/ Golang

Your First Hello World App with Golang

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:

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