Skip to content

Commit 5b633cc

Browse files
committed
Remove newlines from log lines, which are not required
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 1c1bfa6 commit 5b633cc

File tree

9 files changed

+21
-14
lines changed

9 files changed

+21
-14
lines changed

cmd/root.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,16 @@ var rootCommand = &cobra.Command{
3636
Use: "faasd",
3737
Short: "Start faasd",
3838
Long: `
39-
faasd - Serverless For Everyone Else
39+
faasd Community Edition (CE):
4040
4141
Learn how to build, secure, and monitor functions with faasd with
4242
the eBook:
4343
4444
https://openfaas.gumroad.com/l/serverless-for-everyone-else
45+
46+
License: OpenFaaS CE EULA with faasd addendum:
47+
48+
https://github.com/openfaas/faasd/blob/master/EULA.md
4549
`,
4650
RunE: runRootCommand,
4751
SilenceUsage: true,
@@ -68,7 +72,7 @@ func parseBaseCommand(_ *cobra.Command, _ []string) {
6872
}
6973

7074
func printVersion() {
71-
fmt.Printf("faasd version: %s\tcommit: %s\n", pkg.GetVersion(), pkg.GitCommit)
75+
fmt.Printf("faasd Community Edition (CE) version: %s\tcommit: %s\n", pkg.GetVersion(), pkg.GitCommit)
7276
}
7377

7478
func printLogo() {

pkg/connectivity.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
// ConnectivityCheck checks if the controller can reach the
1111
// public Internet via HTTPS.
12-
// A license is required to use OpenFaaS for Commercial Use.
12+
// A license is required to use OpenFaaS CE for Commercial Use.
1313
func ConnectivityCheck() error {
1414
req, err := http.NewRequest(http.MethodGet, "https://checkip.amazonaws.com", nil)
1515
if err != nil {
@@ -27,7 +27,10 @@ func ConnectivityCheck() error {
2727
}
2828

2929
if res.StatusCode != http.StatusOK {
30-
body, _ := io.ReadAll(res.Body)
30+
var body []byte
31+
if res.Body != nil {
32+
body, _ = io.ReadAll(res.Body)
33+
}
3134

3235
return fmt.Errorf("unexpected status code checking connectivity: %d, body: %s", res.StatusCode, strings.TrimSpace(string(body)))
3336
}

pkg/provider/handlers/delete.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func MakeDeleteHandler(client *containerd.Client, cni gocni.CNI) func(w http.Res
3333

3434
req := types.DeleteFunctionRequest{}
3535
if err := json.Unmarshal(body, &req); err != nil {
36-
log.Printf("[Delete] error parsing input: %s\n", err)
36+
log.Printf("[Delete] error parsing input: %s", err)
3737
http.Error(w, err.Error(), http.StatusBadRequest)
3838

3939
return

pkg/provider/handlers/deploy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func MakeDeployHandler(client *containerd.Client, cni gocni.CNI, secretMountPath
4444
req := types.FunctionDeployment{}
4545
err := json.Unmarshal(body, &req)
4646
if err != nil {
47-
log.Printf("[Deploy] - error parsing input: %s\n", err)
47+
log.Printf("[Deploy] - error parsing input: %s", err)
4848
http.Error(w, err.Error(), http.StatusBadRequest)
4949

5050
return

pkg/provider/handlers/read.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func MakeReadHandler(client *containerd.Client) func(w http.ResponseWriter, r *h
3131
res := []types.FunctionStatus{}
3232
fns, err := ListFunctions(client, lookupNamespace)
3333
if err != nil {
34-
log.Printf("[Read] error listing functions. Error: %s\n", err)
34+
log.Printf("[Read] error listing functions. Error: %s", err)
3535
http.Error(w, err.Error(), http.StatusBadRequest)
3636
return
3737
}

pkg/provider/handlers/scale.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func MakeReplicaUpdateHandler(client *containerd.Client, cni gocni.CNI) func(w h
3131

3232
req := types.ScaleServiceRequest{}
3333
if err := json.Unmarshal(body, &req); err != nil {
34-
log.Printf("[Scale] error parsing input: %s\n", err)
34+
log.Printf("[Scale] error parsing input: %s", err)
3535
http.Error(w, err.Error(), http.StatusBadRequest)
3636

3737
return

pkg/provider/handlers/secret.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func listSecrets(store provider.Labeller, w http.ResponseWriter, r *http.Request
7171
}
7272

7373
if err != nil {
74-
fmt.Printf("Error Occured: %s \n", err)
74+
log.Printf("[Secret] Error listing secrets: %s ", err)
7575
http.Error(w, err.Error(), http.StatusInternalServerError)
7676
return
7777
}

pkg/provider/handlers/update.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func MakeUpdateHandler(client *containerd.Client, cni gocni.CNI, secretMountPath
3333
req := types.FunctionDeployment{}
3434
err := json.Unmarshal(body, &req)
3535
if err != nil {
36-
log.Printf("[Update] error parsing input: %s\n", err)
36+
log.Printf("[Update] error parsing input: %s", err)
3737
http.Error(w, err.Error(), http.StatusBadRequest)
3838

3939
return

pkg/supervisor.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,15 @@ func (s *Supervisor) Start(svcs []Service) error {
227227
)
228228

229229
if err != nil {
230-
log.Printf("Error creating container: %s\n", err)
230+
log.Printf("Error creating container: %s", err)
231231
return err
232232
}
233233

234234
log.Printf("Created container: %s\n", newContainer.ID())
235235

236236
task, err := newContainer.NewTask(ctx, cio.BinaryIO("/usr/local/bin/faasd", nil))
237237
if err != nil {
238-
log.Printf("Error creating task: %s\n", err)
238+
log.Printf("Error creating task: %s", err)
239239
return err
240240
}
241241

@@ -268,15 +268,15 @@ func (s *Supervisor) Start(svcs []Service) error {
268268
}
269269

270270
if _, err := task.Wait(ctx); err != nil {
271-
log.Printf("Task wait error: %s\n", err)
271+
log.Printf("Task wait error: %s", err)
272272
return err
273273
}
274274

275275
log.Printf("Task: %s\tContainer: %s\n", task.ID(), newContainer.ID())
276276
// log.Println("Exited: ", exitStatusC)
277277

278278
if err = task.Start(ctx); err != nil {
279-
log.Printf("Task start error: %s\n", err)
279+
log.Printf("Task start error: %s", err)
280280
return err
281281
}
282282
}

0 commit comments

Comments
 (0)