Building CLI Tools in Go

Ashish Thakur · GopherCon 2026

Why Go for CLIs?

  • Single binary, zero dependencies
  • Fast startup time
  • Cross-compilation built in
  • Rich standard library

The Basics

package main

import (
    "fmt"
    "os"
)

func main() {
    if len(os.Args) < 2 {
        fmt.Fprintln(os.Stderr, "usage: greet <name>")
        os.Exit(1)
    }
    fmt.Printf("Hello, %s!\n", os.Args[1])
}

Thank You

Questions?