This repository is a structured, beginner-to-advanced Golang learning collection. Each folder focuses on one core Go concept, with clean examples, practical use-cases, and hands-on code.
The goal of this repository is to:
- Build strong Go fundamentals
- Learn idiomatic Go practices
- Prepare for interviews, backend development, and system programming
GO-LANGUAGE/
β
βββ arr/
βββ crud/
βββ data-conversion/
βββ defer/
βββ error/
βββ file/
βββ for-loop/
βββ function/
βββ goroutine/
βββ if-else/
βββ inputstring/
βββ json/
βββ map/
βββ myutil/
βββ pointer/
βββ slice/
βββ struct/
βββ switch/
βββ sync_waitgroup/
βββ time/
βββ URL/
βββ webRequest/
β
βββ example.txt
βββ go.mod
βββ main.go
- Fixed-size collections in Go
- Declaration and initialization
- Iteration techniques
- Memory behavior
Key Concepts:
- Index-based access
- Value semantics
- Compile-time size
- Dynamic arrays built on top of arrays
append,len,cap- Slice reallocation
Why Important? Slices are the most commonly used collection in Go.
- Key-value data structures
- Insert, update, delete
- Iteration over maps
Key Notes:
- Reference type
- Fast lookups
- Unordered
- Function declaration & invocation
- Multiple return values
- Named return values
- Variadic functions
- Pointer basics
&and*operators- Pass-by-value vs pass-by-reference
Why Pointers Matter?
- Performance
- Shared state
- Custom data types
- Struct fields
- Nested structs
- Struct methods
- Conditional logic
- Short variable declarations
- Best practices
- Switch cases
- Multiple case values
- Type switch
- Classic for-loop
- While-style loop
- Infinite loop
- Range-based loop
- Reading input from user
fmt.Scan,Scanln- Buffer-based input
- Type casting
- String β int conversion
- Float conversions
- Encoding structs to JSON
- Decoding JSON into structs
- Working with APIs
- Error handling in Go
- Custom errors
errors.Newandfmt.Errorf
Go Philosophy:
Errors are values
- File creation
- Read & write operations
- File permissions
- Deferred function calls
- Stack behavior
- Resource cleanup
- Lightweight concurrency
gokeyword- Non-blocking execution
- Synchronizing goroutines
sync.WaitGroupAdd,Done,Wait
Used for:
- Parallel processing
- Safe goroutine completion
- Time delays
- Timers
- Measuring execution time
- URL parsing
- Query parameters
- URL encoding & decoding
- HTTP GET requests
- Handling responses
- Reading API data
- Create, Read, Update, Delete
- REST-style operations
- JSON-based handling
- Sample data file
- Used for file-handling demos
- Entry point of the application
- Used for testing or combined execution
- Module definition file
- Dependency management
- Go 1.20+
- Basic programming knowledge
go run main.goOr run individual topic files:
go run goroutine/main.go- Strong Golang fundamentals
- Concurrency mastery
- Clean and idiomatic Go code
- Interview-ready concepts
- Beginners learning Go
- Backend developers
- Students & interview candidates
- Anyone revising Go concepts
Feel free to fork, improve examples, or add advanced topics like:
- Channels
- Mutex
- Context
- Testing
Rajshekhar Happy Coding with Go πΉπ