Go for Beginners: Why Go and Your First Program

A
Author
03 Oct, 2026 1 min read 1.42K views

Go is a small, compiled language designed at Google for building reliable server software. Docker, Kubernetes, Terraform and many cloud tools are written in it. Its appeal is simplicity: a small language, fast builds, a single static binary and great built-in concurrency.

Install and run

mkdir hello && cd hello
go mod init example.com/hello
go run .
// main.go
package main

import "fmt"

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

The language in five minutes

// Variables
var count int = 3
name := "Asha"            // short declaration with type inference

// Functions can return multiple values
func divide(a, b float64) (float64, error) {
    if b == 0 {
        return 0, fmt.Errorf("cannot divide by zero")
    }
    return a / b, nil
}

// Structs and methods
type User struct {
    ID    int
    Name  string
    Email string
}

func (u User) Greeting() string {
    return "Hi " + u.Name
}

// Slices and maps
scores := []int{90, 75, 88}
scores = append(scores, 92)
ages := map[string]int{"asha": 29, "ravi": 34}

for i, s := range scores {
    fmt.Println(i, s)
}

What makes Go different

  • Errors are values, returned and checked explicitly. No exceptions.
  • Interfaces are implicit: a type satisfies an interface just by having the methods.
  • Goroutines make concurrency cheap: go doWork().
  • One formatting style: gofmt ends style debates.
  • A rich standard library: HTTP servers, JSON, crypto and testing with no third-party packages.
go build -o app .     # one static binary, easy to ship in a tiny container
Was this article helpful?

Comments

No comments yet. Have a question or a tip? Be the first to share it.

Leave a comment

Comments are reviewed before they appear.