Welcome to my GoByExample repository! This repository is part of my journey to learning Go, an open-source programming language designed for building scalable, secure, and reliable software.
GoByExample is a hands-on introduction to Go using annotated example programs. Each example is designed to demonstrate a specific feature or concept in Go, helping you to understand and apply them in your projects.
The following topics are covered in this repository:
- Hello World 🌍
- Values 🧮
- Variables 📊
- Constants 🚦
- For 🔄
- If/Else ❓
- Switch 🔀
- Arrays 🗃️
- Slices 🍰
- Maps 🗺️
- Range 🔁
- Functions 🔧
- Multiple Return Values 🔙
- Variadic Functions ➕
- Closures 🚪
- Recursion 🔄
- Pointers 🧷
- Strings and Runes ✍️
- Structs 🏗️
- Methods 🛠️
- Interfaces 🌐
- Enums 🔢
- Struct Embedding 🏗️
- Generics 💡
- Errors ❗
- Custom Errors ❗
- Goroutines 🧵
- Channels 📡
- Channel Buffering 📦
- Channel Synchronization 📶
- Channel Directions
↔️ - Select 🔀
- Timeouts ⏱️
- Non-Blocking Channel Operations 🛑
- Closing Channels 🚪
- Range over Channels 🔄
- Timers ⏲️
- Tickers ⏰
- Worker Pools 🏊
- WaitGroups ⏳
- Rate Limiting 🚦
- Atomic Counters 💣
- Mutexes 🔒
- Stateful Goroutines 🌐
- Sorting 📑
- Sorting by Functions 📂
- Panic
⚠️ - Defer ⏳
- Recover 💪
- String Functions ✨
- String Formatting 📝
- Text Templates 🖋️
- Regular Expressions 🔍
- JSON 📦
- XML 📄
- Time ⏰
- Epoch 🕰️
- Time Formatting / Parsing ⏲️
- Random Numbers 🎲
- Number Parsing 🔢
- URL Parsing 🌐
- SHA256 Hashes 🔒
- Base64 Encoding 🔐
- Reading Files 📖
- Writing Files ✍️
- Line Filters 🧹
- File Paths 🗂️
- Directories 📁
- Temporary Files and Directories 🗄️
- Embed Directive 📦
- Testing and Benchmarking 🧪
- Command-Line Arguments 💻
- Command-Line Flags 🚩
- Command-Line Subcommands 🔍
- Environment Variables 🌍
- Logging 📜
- HTTP Client 🌐
- HTTP Server 🌍
- Context 📚
- Spawning Processes 🛠️
- Exec'ing Processes 🏃
- Signals 🚨
- Exit 🚪
To get started with the examples, make sure you have Go installed on your machine. You can download and install Go from the official Go website.
Clone this repository to your local machine:
git clone https://github.com/gikenye/GoByExamples.git
cd GoByExample
Run the examples:
go run examples/hello-world.go
Each example is located in the examples
directory. They are named according to the topics they cover. For instance, the hello-world.go
example can be found in the examples
directory.
If you would like to contribute to this repository, feel free to fork the repository and submit a pull request. Please ensure your code follows the Go conventions and includes comments and documentation where necessary.
If you have any questions or suggestions, feel free to reach out to me:
- Email: joegikenye@gmail.com
- GitHub: gikenye
I am currently using Go By Example website to learn Go.
Happy coding! 🚀