Remove newlines from log lines, which are not required

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2024-09-17 11:18:07 +01:00
parent 1c1bfa6759
commit 5b633cc017
9 changed files with 21 additions and 14 deletions

View File

@ -9,7 +9,7 @@ import (
// ConnectivityCheck checks if the controller can reach the
// public Internet via HTTPS.
// A license is required to use OpenFaaS for Commercial Use.
// A license is required to use OpenFaaS CE for Commercial Use.
func ConnectivityCheck() error {
req, err := http.NewRequest(http.MethodGet, "https://checkip.amazonaws.com", nil)
if err != nil {
@ -27,7 +27,10 @@ func ConnectivityCheck() error {
}
if res.StatusCode != http.StatusOK {
body, _ := io.ReadAll(res.Body)
var body []byte
if res.Body != nil {
body, _ = io.ReadAll(res.Body)
}
return fmt.Errorf("unexpected status code checking connectivity: %d, body: %s", res.StatusCode, strings.TrimSpace(string(body)))
}