{"id":28092473,"url":"https://github.com/mateusfigmelo/go_by_examples","last_synced_at":"2025-07-06T03:03:28.534Z","repository":{"id":291276523,"uuid":"977148387","full_name":"mateusfigmelo/go_by_examples","owner":"mateusfigmelo","description":"Go By Example","archived":false,"fork":false,"pushed_at":"2025-05-03T21:38:11.000Z","size":130,"stargazers_count":26,"open_issues_count":2,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-06T03:02:44.490Z","etag":null,"topics":["go","gobyexample","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mateusfigmelo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-03T14:35:19.000Z","updated_at":"2025-06-30T20:23:40.000Z","dependencies_parsed_at":"2025-05-13T13:17:25.594Z","dependency_job_id":"2149b5c7-b5c9-4ee0-b51d-495c9a55b1d1","html_url":"https://github.com/mateusfigmelo/go_by_examples","commit_stats":null,"previous_names":["mateusfigmelo/go_by_examples"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mateusfigmelo/go_by_examples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateusfigmelo%2Fgo_by_examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateusfigmelo%2Fgo_by_examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateusfigmelo%2Fgo_by_examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateusfigmelo%2Fgo_by_examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mateusfigmelo","download_url":"https://codeload.github.com/mateusfigmelo/go_by_examples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mateusfigmelo%2Fgo_by_examples/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263841593,"owners_count":23518482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","gobyexample","golang"],"created_at":"2025-05-13T13:17:21.872Z","updated_at":"2025-07-06T03:03:28.480Z","avatar_url":"https://github.com/mateusfigmelo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go By Examples\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/devicons/devicon/master/icons/go/go-original.svg\" width=\"200\" alt=\"GoLang\"\u003e\n  \u003cbr\u003e\u003cbr\u003e\n\n  [![Go Version](https://img.shields.io/badge/Go-1.21+-00ADD8?style=flat\u0026logo=go)](https://golang.org/dl/)\n  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](https://github.com/mateusfigmelo/go_by_examples/pulls)\n  [![Stars](https://img.shields.io/github/stars/mateusfigmelo/go_by_examples?style=social)](https://github.com/mateusfigmelo/go_by_examples/stargazers)\n  \n  [![Go Reference](https://pkg.go.dev/badge/golang.org/x/example)](https://pkg.go.dev/golang.org/x/example)\n  [![Go Report Card](https://goreportcard.com/badge/github.com/mateusfigmelo/go_by_examples)](https://goreportcard.com/report/github.com/mateusfigmelo/go_by_examples)\n  [![Last Commit](https://img.shields.io/github/last-commit/mateusfigmelo/go_by_examples)](https://github.com/mateusfigmelo/go_by_examples/commits/main)\n  [![Examples](https://img.shields.io/badge/examples-28-00ADD8)](https://github.com/mateusfigmelo/go_by_examples)\n\n  \u003ch3\u003eA comprehensive collection of Go programming examples\u003c/h3\u003e\n  \u003cp\u003eLearn Go by example: from basic concepts to advanced patterns and best practices\u003c/p\u003e\n\u003c/div\u003e\n\n## Examples\n\n1. [Hello World](./examples/01-hello-world) - Basic program structure\n2. [Data Types](./examples/02-data-types) - Types, variables, and constants\n3. [Control Structures](./examples/03-control-structures) - Flow control and branching\n4. [Collections](./examples/04-collections) - Arrays, slices, and maps\n5. [Functions](./examples/05-functions) - Function declarations and usage\n6. [Types and Pointers](./examples/06-types-and-pointers) - Memory management\n7. [Structs and Interfaces](./examples/07-structs-and-interfaces) - Custom types and abstraction\n8. [Generics and Embedding](./examples/08-generics-and-embedding) - Generic programming and composition\n9. [Error Handling](./examples/09-error-handling) - Error types and handling\n10. [Concurrency](./examples/10-concurrency) - Goroutines and basic concurrency\n11. [Advanced Channels](./examples/11-advanced-channels) - Channel patterns and usage\n12. [Worker Pools](./examples/12-worker-pools) - Concurrent worker patterns\n13. [Sync Primitives](./examples/13-sync-primitives) - Mutexes and synchronization\n14. [Sorting](./examples/14-sorting) - Sorting algorithms and interfaces\n15. [Panic, Defer, Recover](./examples/15-panic-defer-recover) - Error flow control\n16. [Strings and Templates](./examples/16-strings-and-templates) - String manipulation\n17. [JSON and XML](./examples/17-json-xml) - Data serialization\n18. [Time Handling](./examples/18-time-handling) - Time operations\n19. [Parsing and Random](./examples/19-parsing-and-random) - Text parsing and randomization\n20. [Hashes and Encoding](./examples/20-hashes-and-encoding) - Cryptography basics\n21. [File Operations](./examples/21-file-operations) - File system handling\n22. [File Utilities](./examples/22-file-utilities) - Advanced file operations\n23. [Testing and Benchmarking](./examples/23-testing-benchmarking) - Advanced testing\n24. [CLI](./examples/24-cli) - Command-line interfaces\n25. [Environment and Logging](./examples/25-env-and-logging) - Configuration and logs\n26. [HTTP Client and Server](./examples/26-http) - HTTP client/server\n27. [Context and Processes](./examples/27-context-and-processes) - Process management\n28. [Signals and Exit](./examples/28-signals-and-exit) - Signal handling\n\n## Prerequisites\n\n- Go 1.21 or higher (some examples use newer features)\n- Basic understanding of Go programming concepts\n- Text editor or IDE\n- Terminal/Command Prompt\n\n## Running Examples\n\nEach example directory contains:\n- Source code files (`.go`)\n- README with explanations and instructions\n- Tests where applicable\n- Any necessary resource files\n\nTo run an example:\n```bash\ncd examples/\u003cexample-directory\u003e\ngo run main.go\n```\n\n## Testing\n\nEach example includes tests that demonstrate proper usage and validate functionality. We use Go's built-in testing framework with some extended features.\n\n### Running Tests\n\nYou can run tests using our Go test runner:\n\n```bash\n# Run all tests\ngo run main.go\n\n# Run tests for a specific example\ngo run main.go 12-worker-pools\n\n# Run tests with coverage\ngo run main.go -c\n\n# Get verbose test output\ngo run main.go -v\n\n# See all options\ngo run main.go -h\n```\n\n### Test Coverage\n\nCoverage reports are generated in HTML format when running tests with the `-c` or `--coverage` flag. These reports are saved in the `coverage/` directory.\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-example`)\n3. Make your changes and add appropriate tests\n4. Ensure all tests pass (`go run main.go`)\n5. Commit your changes (`git commit -m 'Add a new example'`)\n6. Push to the branch (`git push origin feature/amazing-example`)\n7. Create a Pull Request\n\n## Best Practices\n\nEach example follows these principles:\n- Clear and documented code\n- Proper error handling\n- Comprehensive unit tests \n- Table-driven testing where appropriate\n- Consistent formatting (using `go fmt`)\n- Idiomatic Go patterns\n- Performance considerations\n- Security best practices\n\n### Testing Best Practices\n\n- Write tests for all exported functions\n- Use table-driven tests for multiple scenarios\n- Aim for high code coverage (at least 80%)\n- Test both happy paths and error cases\n- Keep tests independent and idempotent\n- Use mocks or stubs for external dependencies\n- Include benchmarks for performance-critical code\n- Write clear failure messages\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateusfigmelo%2Fgo_by_examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmateusfigmelo%2Fgo_by_examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateusfigmelo%2Fgo_by_examples/lists"}