This repository contains the code and materials from a comprehensive 6-month Go programming course that I taught to students interested in learning the Go language. As the instructor, I designed a curriculum that progressed from basic programming concepts to advanced web application development, guiding students through hands-on exercises and projects.
- Basic data types: booleans, integers, and floats
- Variable declaration and initialization (
var
vs:=
) - Constants
- Composite types: arrays, slices, and maps
- Working with slices: append, make, capacity
- Structs and anonymous structs
- Control flow: if statements, conditionals
- Command-line arguments
- Formatting and printing with the
fmt
package - Functions: declarations, parameters, and return values
- Pointers and memory management
- Methods and receiver functions
- Interfaces and type implementations
- Home assignment: Building a book listing and search application
- Go modules and dependency management
- Package organization and visibility
- Concurrency basics
- Goroutines and parallel execution
- Synchronization with WaitGroups
- Worker pools for concurrent task processing
- Race conditions and synchronization primitives
sync.Once
for one-time initialization- Home assignment: Enhanced book management system with concurrency
- File handling and I/O operations
- Working with JSON and other file formats
- Introduction to databases
- GORM (Go Object Relational Mapper)
- Creating models and database migrations
- Basic CRUD operations
- Complex queries and relationships
- Home assignment: Migrating the book management system to use a database
- HTTP client operations
- Building web servers in Go
- Introduction to the
net/http
package - Using the Gorilla Mux router
- REST API principles:
- Client-server architecture
- Statelessness
- Cacheability
- Layered systems
- Code-on-demand
- Uniform interfaces
- API documentation with Swagger
- Home assignment: Creating a RESTful API for the book management system
- Project structure and organization
- Separation of concerns
- Internal vs public packages
- Configuration management
- Middleware and authentication
- Error handling and logging
- API versioning
- Documentation
- Deployment considerations
- Final project: Complete bookstore API with authentication
Each week's directory contains the code examples and exercises covered during that week. To run the code examples:
- Make sure you have Go installed (version 1.16+ recommended)
- Navigate to the specific week's directory
- Run the example files with
go run filename.go
For projects with multiple files, follow the instructions in the respective week's README or comments.
Throughout the course, students worked on a progressive book management system that evolved in complexity:
- Week 2: Simple CLI book listing and searching
- Week 3: Enhanced CLI with additional operations and concurrency
- Week 4: Database integration with GORM
- Week 5: RESTful API implementation
- Week 6: Complete web application with authentication and documentation