Package deal!
Implement two separate modules aka dictionary and picker. The dictionary module produces a list of words from a given dictionary. The picker modules picks a random word leveraging the dictionary module.
- Clone the Labs Repo
- cd modules
- Dictionary Module (modules/dictionary)
- Leveraging the given tests, implement a dictionary loader.
- The loader loads a collection of words from file (see testdata)
- The loader should take a dictionary location and a list of words to exclude from the returned list
- Leveraging the given tests, implement a dictionary loader.
- Picker Module (modules/picker)
- The picker package loads words from the directory module and randomly pick a new word.
- Initially make sure you can reference the dictionary from your own repo using the
replace
directive in go.mod
- Using the provided test suites. Test your entire application
- Make sure the picker cli works as expected.
- Using your own github repo user, version and publish your own dictionary module.
- BONUS!
- Change your picker to reference a class mate dictionary module.
-
Publish your
dictionary
module (modules/dictionary):- On github, create your own git repo using your own GIT_USER_HANDLE
cd modules/dictionary git init git add . git commit -m 'Init drop' git remote add origin [email protected]:YOUR_GIT_USER_HANDLE/dictionary.git git push -u origin master # Tag your repo with version 0.1.0 git tag -a v0.1.0 -m 'Init drop' git push origin v0.1.0
-
Remove the replace directive in picker/go.mod as we are now going to use your published dictionary module
-
In picker/main.go update the import path to use your published dictionary module handle
-
Run the picker app. You should see your dependency getting pulled!
-
Verify your go.mod file is now correctly referencing your new dictionary module!
-
BONUS: Rinse/Repeat the last 3 steps using a classmate dictionary module.
© 2020 Imhotep Software LLC. All materials licensed under Apache v2.0