This repository was archived by the owner on Sep 1, 2020. It is now read-only.
Update main.go - #6
Open
ehsan-fmb wants to merge 2 commits into
Open
Conversation
1995parham
suggested changes
May 18, 2019
1995parham
left a comment
Contributor
There was a problem hiding this comment.
I have commented on your test file and as an example, you can check here. I those tests I have used the testify library that I have introduced you in my comments.
| log.Printf("failed to Unmarshaling:%s",err) | ||
| return c.String(http.StatusInternalServerError,"") | ||
| } | ||
| client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://localhost:27017")) |
Contributor
There was a problem hiding this comment.
Please separate the database connection creation phase from the handler create a stand-alone function for it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
i do what you said.and i give respnse from it.i add golangci-lint .at first it show some errors but i solve them.
then i make test file for that.and again give good response from it.
but i have a problem and hope you to solve it.
the test file print what i expect from it.but at last it give status code 1 that mean to have a error,but i check
http status and it give 200 and print response from server.
i search all of today for that and i can't find anything otherwise i finished it yesterday.
please help 😢
so thankful