This repo is used to practice creating clean code using golang. Created as hands on for my presentation at COMPFEST 2021.
- docker > 20.10.7
# to run app
docker-compose run app
# to run test
docker-compose run test
Clone or fork this repo. Then you can try to refactor on your own. Easy to follow walkthough is available. And the solution is there too if you want to cheat ;) Follow git version to walk through refactoring process and eliminate code smell. Happy refactoring ;)
In general, this walkthough is implemented using TDD fashion. Your job is only 2: make test pass and make sure the app is running fine. There are several branch for each code smell. You should implement in in correct order.
- Code smell: duplicate code.
Checkout usinggit checkout code-smell/duplicate-code
. You will find TODO. Your job is to implement those TODO. - (optional) Solution is at
git checkout code-smell-refactored/duplicate-code
. - Code smell: long method.
Checkout usinggit checkout code-smell/long-method
. You will find TODO. Your job is to implement those TODO. - (optional) Solution is at
git checkout code-smell-refactored/long-method
.