Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add lab 10 - Puppy REST #669
Add lab 10 - Puppy REST #669
Changes from all commits
c531257
98d56ca
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 believe it's overkill, but let's wait for code owners. You are not dealing with graceful shutdown to justify this
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.
My intent was to do real connection testing on
main()
, not just handler testing, and this was a (relatively) elegant way I found tohttp.Shutdown
ahttp.ListenAndServe
; but as I later found out, Travis doesn't allow connections tolocalhost
.So this could had been substituted for a global
http.Server
variable, and the test could hadhttp.Shutdown
the server it before callingmain()
.Which also doesn't feel a good solution despite the simplicity.
So I left it in as it works, and doesn't use another global.
I hope reviewers like it but I admit I'm not high on hopes 🤞
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.
There is a kingpimg flag file type that opens the file as part of command line parsing. saves you the error handling here.
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.
os.Exit(1) or log.Fatal(msg) ?
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.
You are making assumptions on puppy IDs being a sequence, that might be dangerous imo.
I think it's niver if you just impoment the Stringer interface for puppy, and if you truly want to print a slice of puppies, retrieve them as a list and then maybe fmt.Println(strings.Join(puppies, "\n")) or similar. It is a easier to test correct string creation than it is to test correct printing.