Fix gosec finding of unhandled errors (#29398)

Not critical but fixing it to avoid gosec reporting G104.
This commit is contained in:
Jaana Dogan 2020-11-25 23:05:36 -08:00 committed by GitHub
parent 5739764e06
commit 96eefee402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))
}