Commit 96eefee4 by Jaana Dogan Committed by GitHub

Fix gosec finding of unhandled errors (#29398)

Not critical but fixing it to avoid gosec reporting G104.
parent 5739764e
......@@ -4,6 +4,7 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
)
......@@ -15,10 +16,12 @@ func hello(w http.ResponseWriter, r *http.Request) {
line := fmt.Sprintf("webbhook: -> %s", string(body))
fmt.Println(line)
io.WriteString(w, line)
if _, err := io.WriteString(w, line); err != nil {
log.Printf("Failed to write: %v", err)
}
}
func main() {
http.HandleFunc("/", hello)
http.ListenAndServe(":3010", nil)
log.Fatal(http.ListenAndServe(":3010", nil))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment