Go Learning Repository
Track your progress by checking off items as you learn, practice, and implement them in projects.
- Setup & Tooling
- Install Go
- Configure your
$GOPATHand$GOROOT - Set up your code editor (e.g., VS Code with Go extension)
- Write and run "Hello, World!"
- Learn
go run,go build,go fmt,go vet
- Basic Syntax & Concepts
- Packages and Imports
- Variables (
var,:=) and Constants (const) - Basic Data Types:
int,float64,string,bool - Pointers
- Functions (declaration, parameters, multiple return values)
- Control Flow
-
if / elsestatements -
forloops (all variations) -
switchstatements -
defer,panic, andrecover
-
- Core Data Structures
- Arrays
- Slices (and slice operations like
append,make) - Maps
- Structs
- CLI Number Guessing Game: A simple game where the computer picks a number and the user has to guess it.
- Simple Calculator: A command-line tool that takes two numbers and an operator to perform a calculation.
- Word/Character Counter: A tool that reads a string or a file and counts the frequency of each word or character.
- Organizing Code
- Creating your own packages
- Understanding package visibility (exported vs. unexported names)
- Go Modules (
go mod init,go get,go mod tidy)
- Advanced Types & Methods
- Methods (functions with a receiver)
- Interfaces (and satisfying an interface implicitly)
- The
errortype and idiomatic error handling
- Working with Data
- Reading and writing files (
io,ospackages) - Handling JSON (
encoding/jsonpackage)
- Reading and writing files (
- CLI To-Do List: An application to add, list, and complete tasks, storing the data in a JSON file.
- Configuration File Parser: A package that can read a configuration file (e.g., JSON, YAML) into a Go struct.
- Core Concurrency Primitives
- Goroutines
- Channels (buffered and unbuffered)
-
selectstatement for managing multiple channels
- Concurrency Patterns
- Worker pools
- Fan-in, Fan-out
- Synchronization
- Mutex (
sync.Mutex,sync.RWMutex) - WaitGroups (
sync.WaitGroup) - Race condition detection (
go run -race)
- Mutex (
- Concurrent Web Scraper: A tool that fetches multiple URLs concurrently to speed up data gathering.
- Parallel File Processor: A program that processes multiple files in a directory concurrently (e.g., resizing images, parsing logs).
- Standard Library for Web
- Understanding the
net/httppackage - Building a basic web server
- Handling HTTP requests (GET, POST, etc.)
- Routing requests
- Understanding the
- Building APIs
- Designing RESTful API endpoints
- Returning JSON responses
- Parsing JSON from request bodies
- Working with a Database
- Using the
database/sqlpackage - Connecting to a SQL database (e.g., PostgreSQL, SQLite)
- Performing CRUD (Create, Read, Update, Delete) operations
- Using the
- Exploring Web Frameworks (Optional)
- Research popular frameworks like Gin, Echo, or Chi
- Rebuild an API project using a framework
- Simple Blog API: A REST API with endpoints for creating, reading, updating, and deleting blog posts.
- URL Shortener Service: A web service that takes a long URL and returns a shortened one that redirects to the original.
- Testing
- Unit testing with the
testingpackage - Writing benchmarks
- Table-driven tests
- Unit testing with the
- Advanced Concepts
- The
contextpackage for cancellation and deadlines - Reflection (
reflectpackage) -
cgofor calling C code (awareness is enough)
- The
- Deployment & Ecosystem
- Cross-compilation
- Building a Docker container for a Go application
- Explore gRPC as an alternative to REST
- Add Comprehensive Tests: Go back to previous projects and add a robust suite of unit tests.
- Microservice: Create a small, single-purpose service (e.g., an authentication service) that communicates over gRPC or REST.
- Contribute to an Open Source Project: Find a beginner-friendly issue on a Go project and submit a pull request.
Run the example web server in Web_Server/main.go and hit it from Postman, cURL, or VS Code REST clients.
Quick start (from repo root):
# Run the server
go run ./Web_Server
# In another terminal, try a few requests
curl -X POST "http://localhost:8080/users" `
-H "Content-Type: application/json" `
-d '{"id":1,"name":"Alice","age":30}'
curl "http://localhost:8080/users/1"
curl -X DELETE "http://localhost:8080/users/1"Postman (short version):
- Create an Environment with
baseUrl = http://localhost:8080. - Requests:
- POST
{{baseUrl}}/userswith JSON body{ "id": 1, "name": "Alice", "age": 30 } - GET
{{baseUrl}}/users/1 - DELETE
{{baseUrl}}/users/1
- POST
Notes:
- Data is stored in-memory and resets on server restart.
- Endpoints use Go's
net/httpServeMux patterns:POST /users,GET /users/{id},DELETE /users/{id}.
More details (including VS Code REST/Thunder Client examples and troubleshooting): see Web_Server/README.md.