-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lab 6 - CRUD puppy with interface #533
Conversation
Create puupy struct Implement Init to initialize a puppy and assign a random id Implement String method to print a puppy struct At this point there is no check for collision ids Implement a map backed storer only at this time Implement ReadStore Error checking hasnt been implemented. At this stage nil will be returned if the item cant be found. This will be addressed in a later lab Implement DeletePuppy Fix boolean logic in ReadPuppy Implement UpdatePuppy Implement clone method on puppy Resolve problem with usage of pointers and references Separate MapStore into its own file Create a basic main_test Integrate linter feedback Rename ID to id where used as parameter Change mapstore test to use a test suite using the Storer interface Begin implementing a syncstore version of the Storer interface Implement all methids for syncstore Implement all cases for store_tests Ensure 100% test coverqge Fix linter errors Capitals and newlines in error messages Not assign table tests when ranging across them Misalignment of structs Verified lint and code cov passed Separate types into their own file Resolve linting issue in types.go
Codecov Report
@@ Coverage Diff @@
## master #533 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 79 83 +4
Lines 1345 1404 +59
=====================================
+ Hits 1345 1404 +59
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's mostly pretty good.
- Uncommit gitignore file.
- Fix up your test cases.
.gitignore
Outdated
@@ -11,3 +11,4 @@ | |||
# Output of the go coverage tool, specifically when used with LiteIDE | |||
*.out | |||
coverage.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, this file should have not been committed.
puppy.Value = p.Value | ||
return puppy | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of immutability.
puppy: corgi, | ||
wantErr: true}, | ||
} | ||
for _, tt := range tests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a comment. I have written my test cases as unit test cases, as each one test a specific condition. Rather than bundle all the create operations into one. Not saying it's right or wrong. But I think test cases should be atomic. And it will eliminate the need for struct, and making test files shorter.
Change format of test case data Change parameter ordering of test cases Implement ID assignment in storers
The go-course is now closed. Thank you very much for participating. |
Fixes #532
Review of colleague's PR #424
Changes proposed in this PR:
Implement a Puppy struct containing ID, Breed, Colour, Value.
Create Storer interface with CRUD methods for Puppy
Write a MapStore implementation of Storer backed by a map
Write a SyncStore implementation of Storer backed by a sync.Map
Keep all implementation files in the same folder and in package main
Test against the Storer interface and run in suite with both implementations