-
Notifications
You must be signed in to change notification settings - Fork 10
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
fixed linting reported from glangci-lint #11
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11 +/- ##
==========================================
- Coverage 72.35% 70.49% -1.87%
==========================================
Files 6 6
Lines 944 959 +15
==========================================
- Hits 683 676 -7
- Misses 147 158 +11
- Partials 114 125 +11
Continue to review full report at Codecov.
|
cmd/bindings/bindings.go
Outdated
@@ -76,7 +76,9 @@ func cmdBindingsList(b *bindings, printf shared.FormatFn) *cobra.Command { | |||
Args: cobra.NoArgs, | |||
|
|||
Run: func(cmd *cobra.Command, _ []string) { | |||
b.cmdList(printf) | |||
if err := b.cmdList(printf); err != nil { | |||
return |
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.
For the functions like these, we should probably just return the error. Just change the Run:
to RunE:
and the internal code to return b.cmdList(printf)
instead of doing the if check.
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.
Good to know! Will correct it shortly.
cmd/bindings/bindings_test.go
Outdated
@@ -164,7 +164,9 @@ func productTestServer() *httptest.Server { | |||
|
|||
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | |||
w.Header().Set("Content-Type", "application/json") | |||
json.NewEncoder(w).Encode(res) | |||
if err := json.NewEncoder(w).Encode(res); err != nil { | |||
return |
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.
We always either return or log the error - unless the error is absolutely impossible or can't cause side-effects, in which case we can assign to _, but that should be rare. Apply this comment to the other cases...
#9