Closed RachitKeertiDas closed 4 years ago
Nice catch! Don't handle the error by just returning; log a warning using the appropriate function in package logs. Also, run the following command inside the server
directory once you're done:
gofmt -s -w .
This will format all the code you've written.
Thanks for the gofmt
tip! I have added the required changes. To log errors, I have imported the "log" package in helpers.go.
I have used the standard log package as this package has been used in handlers.go. However, the logs package has not been used anywhere in the routes
directory.
Notes:
go fmt
on every commit. To do that, run the config command given in the readme.References:
I have used the standard log package as this package has been used in handlers.go. However, the logs package has not been used anywhere in the
routes
directory.
We'll probably get a proper logging package added soon.
Closed the PR. Sorry. Send a fresh one. Two commits only please. I gave up on @AdaephonBen. Hoping I'll get good git practices from you, @RachitKeertiDas
Roger that.
I have used the standard log package as this package has been used in handlers.go. However, the logs package has not been used anywhere in the
routes
directory.We'll probably get a proper logging package added soon.
Will switch to logrus and then re-send a PR
Add a Route for Leaderboard. Handle GET requests from the user to serve him the leaderboard in the form of JSON.
Also, the helper ServeJSON should simply return incase there is an error is encoding into JSON and should not write a malformed JSON.