This directory contains various Go examples to help you learn the language step by step.
-
- Introduction to Go
- Installation & setup
- Initialization & running a Go program
-
Constant, Variables, and Types
- Basic data types
- Variable declaration
- Constants
-
- Printing to console
- Formatting strings
-
- Fixed-length arrays
- Dynamic slices
- Key-value maps
-
- If/else statements
- Switch cases
- Loops (for, range)
- Control statements (break, continue)
-
- Basic function syntax
- Multiple return values
- Variadic functions
- Defer statements
- Closures
- Recursion
- Anonymous functions
-
- The error interface
- Constructing basic errors
- Expected (sentinel) errors
- Custom error types
- Error handling best practices
- Panic and Recover
-
- Basic function syntax
- Custom Types
-
- Methods
- Interface
-
- Package organization
- Module management
- Local/remote imports
- Semantic versioning
-
- Type Casting
- Type Inference
- Type Assertions
- Type Switches
- Maps and Make
- Pointers
- Generics
-
- Goroutines
- Channels (Buffered and Unbuffered)
- Select Statement
- Synchronization (WaitGroup, Mutex)
-
File I/O and Working with JSON
- File I/O
- Working with JSON
- JSON Marshalling and Unmarshalling
- JSON Encoding and Decoding
-
- Writing tests
- Test Driven Development
- Package testing
- Table-driven tests
-
- Basic CLI
- Flags
- Subcommands
- Parsing arguments
-
Web Development
- HTTP Server
- basic server
- multiplexing
- multiple server configuration
- HTTP Client
- basic client
- request and response
- error handling
- HTTP Server
-
Database
- Navigate to the specific example directory
- Read the comments in the code for explanation
- Run the program using:
go run main.go
- Take time to understand each concept before moving to the next
- Try to modify the examples to experiment with the code
- Use
go doc
command to read documentation - Practice writing your own programs using learned concepts