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¶
- 01 - Basics - Basic types, variables, operators, conditionals, and loops
- 02 - Arrays and Slices - Working with arrays and slices
- 03 - Functions - Functions, closures, defer, and variadic functions
- 04 - Structs - Struct types, methods, and composition
- 05 - Maps - Hash maps and key-value pairs
- 06 - Pointers - Memory addresses and references
- 07 - Methods and Interfaces - Object-oriented programming in Go
- 08 - Errors - Error handling patterns and best practices
- 09 - Testing - Unit tests, benchmarks, and examples
- 10 - Concurrency - Goroutines, channels, and concurrency patterns
- 11 - Standard Library - Common packages (fmt, strings, time, io, http, etc.)
Quick Start¶
Hello World¶
Run and Build¶
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.