Skip to content

Commit

Permalink
Pass os.Stdout directly rather than via intermediate var
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-nguyen committed Jul 9, 2018
1 parent 6bc3212 commit 35c4c6f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions daemon/inertiad/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,20 @@ var webhookSecret = "inertia"
// webhookHandler writes a response to a request into the given ResponseWriter.
func webhookHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, common.MsgDaemonOK)
outStream := os.Stdout

payload, err := webhook.Parse(r, outStream)
payload, err := webhook.Parse(r, os.Stdout)
if err != nil {
fmt.Fprintln(outStream, err.Error())
fmt.Fprintln(os.Stdout, err.Error())
return
}

switch event := payload.GetEventType(); event {
case webhook.PushEvent:
processPushEvent(payload, outStream)
processPushEvent(payload, os.Stdout)
// case webhook.PullEvent:
// processPullRequestEvent(payload)
default:
fmt.Fprintln(outStream, "Unrecognized event type")
fmt.Fprintln(os.Stdout, "Unrecognized event type")
}
}

Expand Down

0 comments on commit 35c4c6f

Please sign in to comment.