A comprehensive, beginner-friendly Go programming language learning resource covering fundamental concepts through advanced concurrency patterns.
This repository is a structured learning guide for Go (Golang), an open-source programming language created by Google. Go is used for a variety of purposes, including:
- π Web Development - Building REST APIs and web services
- βοΈ Cloud Infrastructure - Kubernetes, Docker, and cloud-native applications
- π₯οΈ Server Management - High-performance backend services
- β‘ Systems Programming - Concurrent and parallel computing
Whether you're a complete beginner or have programming experience in other languages, this repository provides practical examples and explanations for every Go concept.
The repository is organized into 24 progressive modules, each focusing on a specific Go concept:
| Module | Topic | Description |
|---|---|---|
| 01 | Hello World | Getting started with your first Go program |
| 02 | Simple Values | Working with integers, floats, strings, and booleans |
| 03 | Variables | Variable declaration, initialization, and scope |
| 04 | Constants | Working with immutable constant values |
| Module | Topic | Description |
|---|---|---|
| 05 | For Loop | Understanding Go's iteration construct |
| 06 | If/Else | Conditional statements and branching |
| 07 | Switch | Switch statements for multi-way branching |
| Module | Topic | Description |
|---|---|---|
| 08 | Arrays | Fixed-size collections of elements |
| 09 | Slices | Dynamic, flexible arrays in Go |
| 10 | Maps | Key-value pairs and hash tables |
| 11 | Range | Iterating over collections efficiently |
| Module | Topic | Description |
|---|---|---|
| 12 | Functions | Defining and calling functions, multiple returns |
| 13 | Variadic Functions | Functions with variable number of arguments |
| 14 | Closures | Functions that capture variables from outer scope |
| 15 | Pointers | Working with memory addresses and references |
| Module | Topic | Description |
|---|---|---|
| 16 | Structs | Grouping related data into composite types |
| 17 | Interfaces | Defining contracts and polymorphism |
| 18 | Enums | Implementing enumeration patterns |
| Module | Topic | Description |
|---|---|---|
| 19 | Generics | Type-safe, reusable code with generics (Go 1.18+) |
| 20 | Goroutines | Lightweight concurrency primitives |
| 21 | Channels | Communication between goroutines |
| 22 | Mutex | Synchronization and mutual exclusion |
| 23 | File Operations | Reading and writing files |
| 24 | Packages | Organizing code into reusable modules |
- Go 1.x installed on your system (Download Go)
- Basic understanding of programming concepts (helpful but not required)
- A text editor or IDE (VS Code, GoLand, etc.)
-
Clone the repository:
git clone https://github.com/isinghabhishek/golang_basic.git cd golang_basic -
Verify Go installation:
go version
-
Navigate to any module and run examples:
cd 1_hello_world go run main.go
- Start with module 01 - Hello World and progress sequentially
- Read the comments in each code file carefully
- Modify the examples and experiment with different inputs
- Try to solve the challenges before looking at solutions
- Jump directly to topics you want to learn
- Compare Go's approach with languages you know
- Focus on modules like Goroutines, Channels, and Generics
- Use this as a quick reference guide
- β Read and understand each example thoroughly
- β Run every example and observe the output
- β Modify code to see how it behaves
- β Practice writing your own variations
- β Move to the next module only after understanding the current one
golang_basic/
βββ 1_hello_world/ # Your first Go program
βββ 2_simple_values/ # Basic data types
βββ 3_variables/ # Variable declarations
βββ ...
βββ 24_packages/ # Organizing code into packages
βββ go.mod # Go module definition
βββ LICENSE # MIT License
βββ CODE_OF_CONDUCT.md # Community guidelines
βββ README.md # This file
Each module directory contains:
main.go- Example code demonstrating the concept- Comments explaining key points and concepts
- Practical, runnable examples
By completing this repository, you will:
β Understand Go's syntax and core language features β Master data structures (arrays, slices, maps) β Write functions and understand scope β Implement object-oriented patterns with structs and interfaces β Build concurrent applications with goroutines and channels β Work with files and packages β Apply modern Go features like generics β Be ready to build real-world applications
Contributions are welcome! If you find bugs, have suggestions, or want to add improvements:
- Fork the repository
- Create a feature branch (
git checkout -b feature/improvement) - Commit your changes (
git commit -m 'Add improvement') - Push to the branch (
git push origin feature/improvement) - Open a Pull Request
Please follow the Code of Conduct and ensure your code is well-commented and follows Go conventions.
- Official Go Documentation
- Go by Example
- Effective Go
- Go Blog
- Go Playground - Try Go in your browser
This project is licensed under the MIT License - see the LICENSE file for details.
Abhishek Singh (@isinghabhishek)
If you have questions or need help:
- Open an Issue
- Check existing discussions
- Review the code comments and examples
If you find this repository helpful, please give it a β Star! It helps others discover this learning resource.
Happy Coding! π