Skip to content

kailee55n/go_by_examples

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go By Examples

GoLang

Go Version License PRs Welcome Stars

Go Reference Go Report Card Last Commit Examples

A comprehensive collection of Go programming examples

Learn Go by example: from basic concepts to advanced patterns and best practices

Examples

  1. Hello World - Basic program structure
  2. Data Types - Types, variables, and constants
  3. Control Structures - Flow control and branching
  4. Collections - Arrays, slices, and maps
  5. Functions - Function declarations and usage
  6. Types and Pointers - Memory management
  7. Structs and Interfaces - Custom types and abstraction
  8. Generics and Embedding - Generic programming and composition
  9. Error Handling - Error types and handling
  10. Concurrency - Goroutines and basic concurrency
  11. Advanced Channels - Channel patterns and usage
  12. Worker Pools - Concurrent worker patterns
  13. Sync Primitives - Mutexes and synchronization
  14. Sorting - Sorting algorithms and interfaces
  15. Panic, Defer, Recover - Error flow control
  16. Strings and Templates - String manipulation
  17. JSON and XML - Data serialization
  18. Time Handling - Time operations
  19. Parsing and Random - Text parsing and randomization
  20. Hashes and Encoding - Cryptography basics
  21. File Operations - File system handling
  22. File Utilities - Advanced file operations
  23. Testing and Benchmarking - Advanced testing
  24. CLI - Command-line interfaces
  25. Environment and Logging - Configuration and logs
  26. HTTP Client and Server - HTTP client/server
  27. Context and Processes - Process management
  28. Signals and Exit - Signal handling

Prerequisites

  • Go 1.21 or higher (some examples use newer features)
  • Basic understanding of Go programming concepts
  • Text editor or IDE
  • Terminal/Command Prompt

Running Examples

Each example directory contains:

  • Source code files (.go)
  • README with explanations and instructions
  • Tests where applicable
  • Any necessary resource files

To run an example:

cd <example-directory>
go run main.go

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-example)
  3. Commit your changes (git commit -m 'Add a new example')
  4. Push to the branch (git push origin feature/amazing-example)
  5. Create a Pull Request

Best Practices

Each example follows these principles:

  • Clear and documented code
  • Proper error handling
  • Unit tests where applicable
  • Consistent formatting (using go fmt)
  • Idiomatic Go patterns
  • Performance considerations
  • Security best practices

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Go By Example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.9%
  • HTML 0.1%