Skip to content

Commit a4b7293

Browse files
committed
Update utils
1 parent 13bc87c commit a4b7293

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

functions/src/utils/utils.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,21 @@ func ParseRequestBody(r *http.Request, v interface{}) error {
3636
}
3737

3838
func ServeFunction(url string, handler func(http.ResponseWriter, *http.Request)) {
39-
port := flag.Int("port", -1, "specify a port to use http rather than AWS Lambda")
39+
port := flag.Int("port", -1, "specify a port")
4040
flag.Parse()
4141
listener := gateway.ListenAndServe
42-
portStr := "n/a"
42+
addr := ""
4343
if *port != -1 {
4444
err := godotenv.Load()
4545
if err != nil {
4646
log.Print("Failed to load .env file")
4747
}
48-
portStr = fmt.Sprintf(":%d", *port)
48+
addr = fmt.Sprintf(":%d", *port)
4949
listener = http.ListenAndServe
5050
http.Handle("/", http.FileServer(http.Dir("./public")))
5151
}
5252
http.HandleFunc(url, handler)
5353

54-
log.Printf("Function `%s` running on port %s...", url, portStr)
55-
log.Fatal(listener(portStr, nil))
54+
log.Printf("Function `%s` running on %s...", url, addr)
55+
log.Fatal(listener(addr, nil))
5656
}

0 commit comments

Comments
 (0)