{"id":49573728,"url":"https://github.com/pitercoding/golang-basics","last_synced_at":"2026-05-03T15:39:38.131Z","repository":{"id":354209894,"uuid":"1218992409","full_name":"pitercoding/golang-basics","owner":"pitercoding","description":"[EN]  Go learning repository that brings together small hands-on exercises and incremental mini-projects. [PT-BR] Repositório de aprendizado em Go que reúne exercícios práticos pequenos e mini-projetos incrementais.","archived":false,"fork":false,"pushed_at":"2026-04-28T13:39:51.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-03T15:39:05.369Z","etag":null,"topics":["basics-of-go","exercises","golang","learning-by-doing","rest-api"],"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/pitercoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-23T12:23:57.000Z","updated_at":"2026-04-28T13:44:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pitercoding/golang-basics","commit_stats":null,"previous_names":["pitercoding/golang-basics"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pitercoding/golang-basics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitercoding%2Fgolang-basics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitercoding%2Fgolang-basics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitercoding%2Fgolang-basics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitercoding%2Fgolang-basics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pitercoding","download_url":"https://codeload.github.com/pitercoding/golang-basics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitercoding%2Fgolang-basics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32575114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["basics-of-go","exercises","golang","learning-by-doing","rest-api"],"created_at":"2026-05-03T15:39:37.340Z","updated_at":"2026-05-03T15:39:38.095Z","avatar_url":"https://github.com/pitercoding.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eGolang Basics\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eLanguages:\u003c/strong\u003e\u003cbr\u003e\n  \u003ca href=\"README.pt.md\"\u003ePortuguese\u003c/a\u003e |\n  \u003ca href=\"README.md\"\u003eEnglish\u003c/a\u003e\n\u003c/p\u003e\n\nGolang Basics is a **Go learning repository** that brings together small hands-on exercises and incremental mini-projects to practice core language concepts step by step.\n\nThe repository currently includes:\n\n- introductory Go programs covering syntax, loops, functions, pointers, arrays, slices, maps, structs, interfaces, composition, and error handling\n- modularization exercises with local packages and multiple `go.mod` setups\n- a calculator example split into packages to practice project organization\n- a simple REST API example with HTTP handlers, use cases, repositories, request/response models, and an in-memory data flow\n\n## 🎯 Project Motivation\n\nThis repository was built to study Go in a progressive and practical way.\n\nThe main goal is to keep a single place for experiments that move from basic syntax to more structured application design, making it easier to revisit concepts and compare simpler exercises with more complete examples.\n\nIt is especially useful to practice:\n\n- Go syntax and standard library fundamentals\n- value vs pointer behavior\n- slices, maps, structs, and interfaces\n- package organization and module usage\n- separation of concerns in a small REST API\n\n## ✅ Current Content\n\n### 📘 Learning Exercises\n\n- basic \"hello world\" and build examples\n- arithmetic and age calculation exercises\n- loops and `for range`\n- functions with copy and reference parameters\n- pointer practice\n- arrays, slices, capacities, subslices, and `make`\n- maps and map iteration\n- structs, interfaces, and composition\n- error handling exercises\n\n### 📦 Module and Package Practice\n\n- `24_mod` for a simple module with internal packages\n- `25_calculadora_modular` for a calculator split into packages\n- root `go.work` configured to work with multi-module examples\n\n### 🌐 REST API Example\n\nThe `26_rest_api` folder contains the most complete example in the repository so far.\n\nCurrent implementation:\n\n- API bootstrap through `cmd/api`\n- simple client request example through `cmd/client`\n- `GET /users` endpoint to list users\n- `POST /users` endpoint to create users\n- request and response models for user creation\n- in-memory user repository\n- use case layer with duplicate email validation\n- UUID generation for created users\n- JSON responses for success and error cases\n\n## 🔄 Learning Progression\n\nThe repository is organized as a progression rather than a single app.\n\nTypical path:\n\n1. Start with isolated language exercises in numbered folders\n2. Move to package and module organization examples\n3. Finish with the REST API example that applies those concepts in a more realistic structure\n\n## 🧰 Technologies\n\n- Go 1.26.2\n- Go standard library\n- `github.com/google/uuid`\n- Go modules and `go.work`\n\n## ▶️ How to Run Locally\n\n### 1. 📥 Clone the repository\n\n```bash\ngit clone https://github.com/pitercoding/golang-basics.git\ncd golang-basics\n```\n\n### 2. ▶️ Run a basic example\n\nFrom the repository root, run any numbered example:\n\n```bash\ngo run ./00_hello\n```\n\nYou can replace `00_hello` with any other learning folder such as `10_for_range` or `20_map`.\n\n### 3. 🧮 Run the modular calculator example\n\n```bash\ngo run ./25_calculadora_modular\n```\n\n### 4. 🌐 Run the REST API example\n\nStart the API:\n\n```bash\ngo run ./26_rest_api/cmd/api\n```\n\nThe API runs on:\n\n- `http://localhost:8080`\n\n### 5. 🧪 Run the REST client example\n\nWith the API running in another terminal:\n\n```bash\ngo run ./26_rest_api/cmd/client\n```\n\n### 6. 🗂️ Workspace note\n\nThis repository uses a `go.work` file for the multi-module examples. If you add new module folders later, include them in `go.work` when needed.\n\n## 🔌 REST API Notes\n\nCurrent endpoints in `26_rest_api`:\n\n- `GET /users`\n- `POST /users`\n\nExample request body:\n\n```json\n{\n  \"name\": \"Racha Cuca\",\n  \"email\": \"rc@test.com\"\n}\n```\n\nCurrent behavior:\n\n- users are stored in memory\n- each new user receives a generated UUID\n- duplicate emails are rejected in the use case layer\n- responses are encoded as JSON\n\n## 🧪 Testing Status\n\nCurrent status:\n\n- no automated test suite has been added yet\n- the repository is focused on learning and manual experimentation for now\n\nRecommended next test scope:\n\n- add unit tests for the REST API use case layer\n- add handler tests for `GET /users` and `POST /users`\n- add validation tests for duplicate email scenarios\n\n## 🔮 Next Improvements\n\n### 📦 Learning Content\n\n- add more exercises around goroutines and channels\n- add examples for file I/O and JSON parsing\n- add more interface and composition challenges\n\n### 🌐 REST API\n\n- persist users in a real database instead of memory\n- improve HTTP status handling for business errors\n- add request validation for empty name and email\n- add update and delete user endpoints\n- add tests for handlers, repositories, and use cases\n\n### 🛠️ Tooling\n\n- add linting and formatting workflow\n- add CI for building and testing examples\n- document each numbered folder with short learning notes\n\n## 📁 Folder Structure\n\n```text\ngolang-basics/\n|-- 00_hello/                      # Introductory example\n|-- 01_build/                      # Build and execution basics\n|-- 02_sum/                        # Simple arithmetic\n|-- 03_age/                        # Variables and calculations\n|-- 04_loops/                      # Loop practice\n|-- 05_birth_year_challenge/       # Small logic challenge\n|-- 06_functions/                  # Functions basics\n|-- 07_copy_params/                # Value parameter behavior\n|-- 08_ref_params/                 # Reference parameter behavior\n|-- 09_ponteiros/                  # Pointer practice\n|-- 10_for_range/                  # Range iteration\n|-- 11_struct/                     # Struct basics\n|-- 12_errors/                     # Error handling practice\n|-- 13_calculadora/                # Calculator example\n|-- 14_arrays/                     # Arrays\n|-- 15_slices/                     # Slices\n|-- 16_slices_from_arrays/         # Slices from arrays\n|-- 17_slices_cap/                 # Slice capacity\n|-- 18_slices_make/                # Slice creation with make\n|-- 19_subslices/                  # Subslices\n|-- 20_map/                        # Map basics\n|-- 21_map_iter/                   # Map iteration\n|-- 22_interface_01/               # Interface basics\n|-- 23_composition/                # Composition practice\n|-- 24_mod/                        # Module and package example\n|-- 25_calculadora_modular/        # Modular calculator project\n|-- 26_rest_api/                   # REST API learning project\n|   |-- cmd/\n|   |   |-- api/                   # API entrypoint\n|   |   `-- client/                # HTTP client example\n|   |-- internal/\n|   |   |-- handlers/              # HTTP handlers\n|   |   |-- models/                # Request/response and domain models\n|   |   |-- repositories/          # Repository abstractions and memory implementation\n|   |   `-- usecases/              # Business logic\n|   |-- go.mod\n|   `-- go.sum\n|-- go.mod                         # Root module for simple exercises\n|-- go.work                        # Workspace for multi-module examples\n|-- LICENSE\n|-- README.md                      # Documentation (English)\n`-- README.pt.md                   # Documentation (Portuguese)\n```\n\n## 📄 License\n\nThis project is licensed under the **MIT License**.\n\n## 👤 Author\n\n**Piter Gomes** - Computer Science Student (6th Semester) \u0026 Full-Stack Developer\n\n[Email](mailto:piterg.bio@gmail.com) | [LinkedIn](https://www.linkedin.com/in/piter-gomes-4a39281a1/) | [GitHub](https://github.com/pitercoding) | [Portfolio](https://portfolio-pitergomes.vercel.app/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpitercoding%2Fgolang-basics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpitercoding%2Fgolang-basics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpitercoding%2Fgolang-basics/lists"}