Repository navigation
第8回の課題(大倉) - #45
Open
ookura-mf wants to merge 3 commits into
Open
第8回の課題(大倉)#45ookura-mf wants to merge 3 commits into
ookura-mf wants to merge 3 commits into
Conversation
mf-sakura
reviewed
Apr 19, 2020
mf-sakura
left a comment
Owner
There was a problem hiding this comment.
golintが通らない箇所があるので、それだけコメントしました。
Comment on lines
+55
to
+60
| func noNameUserContext() echo.Context { | ||
| e := echo.New() | ||
| invalidReq := httptest.NewRequest(http.MethodPost, "/users", strings.NewReader(noNameUserJSON)) | ||
| invalidReq.Header.Set(echo.HeaderContentType, echo.MIMEApplicationJSON) | ||
| return e.NewContext(invalidReq, httptest.NewRecorder()) | ||
| } |
Comment on lines
+62
to
+67
| func indexContext() echo.Context { | ||
| e := echo.New() | ||
| validReq := httptest.NewRequest(http.MethodGet, "/users", nil) | ||
| validReq.Header.Set(echo.HeaderContentType, echo.MIMEApplicationJSON) | ||
| return e.NewContext(validReq, httptest.NewRecorder()) | ||
| } |
Comment on lines
+112
to
+120
| { | ||
| name: "ユーザー名が空", | ||
| fields: fields{ | ||
| db: nil, | ||
| repository: &mockUserRepository{}, | ||
| }, | ||
| args: args{c: noNameUserContext()}, | ||
| wantErr: true, | ||
| }, |
Comment on lines
+150
to
+165
| { | ||
| name: "正常系", | ||
| fields: fields{ | ||
| db: nil, | ||
| repository: &mockUserRepository{}, | ||
| }, | ||
| args: args{c: indexContext()}, | ||
| }, | ||
| { | ||
| name: "異常系", | ||
| fields: fields{ | ||
| db: nil, | ||
| repository: &mockUserRepository{isError: true}, | ||
| }, | ||
| args: args{c: indexContext()}, | ||
| wantErr: true, |
Comment on lines
+45
to
+47
| userIds := make([]int, len(r.users)) | ||
| index := 0 | ||
| for userId := range r.users { |
Owner
There was a problem hiding this comment.
golintに以下の様な怒られ方をするので、userID, userIDsにするのが良いと思います。
IDは固有名詞の様なものなので、IdではなくIDが推奨だと思われます。
$ golint ./interface/api/interfaces/database/user_local_repository.go
./interface/api/interfaces/database/user_local_repository.go:47:6: range var userId should be userID
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.