Minor additions
This commit is contained in:
8
main.go
8
main.go
@@ -1,11 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"flag"
|
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
port_arg := os.Getenv("FIB_PORT")
|
port_arg := os.Getenv("FIB_PORT")
|
||||||
if port_arg != "" {
|
if port_arg != "" {
|
||||||
fmt.Printf("Loaded port value '%s' from environment.\n",port_arg)
|
fmt.Printf("Loaded port value '%s' from environment.\n", port_arg)
|
||||||
port_number, error = strconv.Atoi(port_arg)
|
port_number, error = strconv.Atoi(port_arg)
|
||||||
if error != nil {
|
if error != nil {
|
||||||
fmt.Printf("I had an error trying to parse '%s' into a number: %s\n",
|
fmt.Printf("I had an error trying to parse '%s' into a number: %s\n",
|
||||||
@@ -33,9 +33,9 @@ func main() {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flag.IntVar(&port, "port", 8098,
|
flag.IntVar(&port, "port", 8098,
|
||||||
fmt.Sprintf("Port number to bind to, default %d", port_number))
|
fmt.Sprintf("Port number to bind to, default %d", port_number))
|
||||||
flag.IntVar(&seq, "number", 0,
|
flag.IntVar(&seq, "number", 0,
|
||||||
"Fibonacci sequence value to calculate")
|
"Fibonacci sequence value to calculate")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user