Skip to content

Go Programming Language

Complete guide to Go programming with organized topics and practical examples.

Documentation Structure

This guide is organized into separate files for easier navigation:

Getting Started

  • 00 - Project Setup - How to initialize projects, install packages, create local/remote packages, run/build applications, and Docker builds (including multi-stage)

Core Concepts

Quick Start

Hello World

package main

import "fmt"

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

Run and Build

# Run directly
go run main.go

# Build executable
go build -o myapp

# Run tests
go test ./...

Go CLI Commands Reference

# Compile & Run
go run [file.go]

# Build executable
go build [file.go]
go build -o [output-name]

# Test packages
go test ./...
go test -v
go test -cover

# Install packages/modules
go get [module]
go install [package]

# Manage dependencies
go mod init [module-name]
go mod tidy
go mod download

# Format code
go fmt ./...

# List packages
go list ./...

# View documentation
go doc [package]

# Environment info
go env
go version

Project Structure

my-project/
├── go.mod              # Module definition
├── go.sum              # Dependency checksums
├── main.go             # Entry point
├── cmd/                # Command-line apps
├── internal/           # Private code
├── pkg/                # Public libraries
└── vendor/             # Vendored dependencies (optional)

Resources


Note: This file serves as an index. Click on the links above to explore each topic in detail.