Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
quantonganh committed Dec 4, 2023
1 parent 5a5a0aa commit 5838075
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions http/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"github.com/rs/zerolog/hlog"
)

const errOops = "Oops! Something went wrong."

type appHandler func(w http.ResponseWriter, r *http.Request) error

// Error parse HTTP error and write to header and body
Expand Down
1 change: 1 addition & 0 deletions http/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ func (s *Server) healthCheckHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)

//nolint:errcheck
io.WriteString(w, `{"alive": true}`)
}
2 changes: 2 additions & 0 deletions http/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ func TestConfirmHandler(t *testing.T) {
assert.Equal(t, http.StatusOK, w.Code)
var subscriptionResp *mailbus.SubscriptionResponse
err = json.NewDecoder(resp.Body).Decode(&subscriptionResp)
require.NoError(t, err)
assert.Equal(t, thankyouMessage, subscriptionResp.Message)
}

Expand Down Expand Up @@ -144,5 +145,6 @@ func TestUnsubscribeHandler(t *testing.T) {
assert.Equal(t, http.StatusOK, w.Code)
var subscriptionResp *mailbus.SubscriptionResponse
err = json.NewDecoder(resp.Body).Decode(&subscriptionResp)
require.NoError(t, err)
assert.Equal(t, unsubscribeMessage, subscriptionResp.Message)
}
1 change: 1 addition & 0 deletions http/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,6 @@ func (s *Server) confirmHandler(w http.ResponseWriter, r *http.Request) error {
func writeJSONResponse(w http.ResponseWriter, statusCode int, response interface{}) {
w.Header().Set("ContentType", "application/json")
w.WriteHeader(statusCode)
//nolint:errcheck
json.NewEncoder(w).Encode(response)
}

0 comments on commit 5838075

Please sign in to comment.