20-Day Go Training Curriculum
20-Day Go Training Curriculum
Day 1: Introduction to Go
● Overview
○ History and design philosophy of Go
○ Use cases and advantages
● Setup
○ Installing Go on various platforms
○ Setting up Go workspace and environment variables
● First Program
○ Writing and running a simple Go program
○ Understanding the main package and function
● Exercises
○ Install Go and set up the workspace
○ Write and run a "Hello, World!" program
○ Explore “builtin” package
○ Try to have multiple main packages in same project
● Syntax
○ Basic program structure
○ Comments, semicolons, and keywords
● Data Types
○ Primitive types: int, float, string, bool
○ Type inference and conversion
○ Pointers and their usage
○ Sizes of datatypes
● Exercises
○ Experiment with different data types and type conversions
○ Write a program that demonstrates the use of pointers
● Conditional Statements
○ if, else if, else
○ Short variable declarations in conditions
● Switch Statements
○ Simple switch cases
○ Multiple expressions and fallthrough
● Loops
○ for loops: traditional, range-based, infinite loops
○ Break and continue statements
● Exercises
○ Write a program using conditional statements
○ Implement a loop to iterate over a slice of data
Day 4: Functions
● Function Basics
○ Defining and calling functions
○ Parameters and return values
● Advanced Function Features
○ Named return values
○ Variadic functions
○ Anonymous functions and closures
● Defer, Panic, and Recover
○ Understanding and using defer
○ Error handling with panic and recover
● Exercises
○ Create functions with various parameter and return value combinations
○ Experiment with defer, panic, and recover in error handling
● Arrays
○ Declaration, initialization, and manipulation
○ Multidimensional arrays
● Slices
○ Creating slices from arrays
○ Slice operations: append, copy, and slicing
● Maps
○ Creating and manipulating maps
○ Iterating over map elements
● Exercises
○ Write programs to demonstrate array, slice, and map operations
○ Create a program that uses maps to count word frequencies in a text
● Structs
○ Defining and initialising structs
○ Important takeaways on tags, data types
○ Nested and anonymous structs
● Methods
○ Defining methods on structs
○ Pointer vs value receivers
● Embedded Structs
○ Composition and inheritance-like behavior
● Exercises
○ Create and use structs in a program
○ Implement methods for struct manipulation
Day 7: Interfaces
● Interface Basics
○ Defining and implementing interfaces
○ Empty interface and type assertions
● Advanced Interface Concepts
○ Type switches
○ Mocking with interfaces
● Exercises
○ Implement interfaces and use type assertions
○ Write a program that uses interfaces for polymorphism
● Goroutines
○ Creating and managing goroutines
○ Synchronisation issues and best practices
● Channels
○ Creating and using channels
○ Buffered vs unbuffered channels
● Exercises
○ Write a program using goroutines to perform concurrent tasks
○ Implement communication between goroutines using channels
● Select Statement
○ Using select to handle multiple channels
● Worker Pools
○ Creating a pool of worker goroutines
○ Distributing tasks among workers
● Context Package
○ Using context for cancellation and timeouts
● Exercises
○ Implement a worker pool pattern
○ Write a program that uses select to handle multiple channels
● Error Basics
○ Error type and idiomatic error handling
● Custom Errors
○ Creating and using custom error types
● Error Wrapping
○ Using fmt.Errorf and errors package for error wrapping
● Exercises
○ Implement custom error types
○ Write a program that demonstrates error wrapping and unwrapping
● JSON Basics
○ Encoding and decoding JSON
○ Working with structs and JSON tags
● Custom Serialization
○ Custom marshaling and unmarshaling
● Exercises
○ Create a program that reads and writes JSON data
○ Implement custom JSON serialization for complex types
● Connecting to a Database
○ Using database/sql package to connect to databases
○ Configuring connection pools
● CRUD Operations
○ Implementing Create, Read, Update, Delete operations
● Using ORM Libraries
○ Introduction to GORM and its usage
● Exercises
○ Set up a database and connect to it using Go
○ Implement CRUD operations using raw SQL and GORM
● Unit Testing
○ Writing tests with the testing package
○ Table-driven tests and subtests
● Mocking and Stubbing
○ Using interfaces for mocking
○ External packages like Testify
● Exercises
○ Write unit tests for various functions
○ Implement mocks and stubs for testing
● Project Overview
○ Define the project: A RESTful API service for an e-commerce platform
● Requirements and Architecture
○ Functional and non-functional requirements
○ High-level architecture and design
● Setup
○ Initialize the project repository and structure
● Exercises
○ Set up the project repository and basic structure
● Business Logic
○ Add business logic for order management
○ Implement validation and error handling
● Authentication and Authorization
○ Implement user authentication (e.g., JWT)
○ Role-based access control
● Exercises
○ Implement business logic and validation
○ Add authentication and authorization to the API
● Advanced Features
○ Implement search and filtering for products
○ Add pagination to API responses
● Testing and Documentation
○ Write unit and integration tests for the API
○ Document the API using Swagger or similar tools
● Exercises
○ Add advanced features and test them
○ Create API documentation
Project Description:
Project Deliverables:
Price : 30,000 INR per student. (This is final price and refunds are not encouraged)