From 0a546dd468eedb8ee062d4cf8cbe59742b934d3d Mon Sep 17 00:00:00 2001 From: Seednode Date: Tue, 18 Oct 2022 16:54:01 -0500 Subject: [PATCH] Changed port type from int to uint16 --- README.md | 11 +++++------ cmd/root.go | 4 ++-- cmd/version.go | 2 +- cmd/web.go | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d00f206..52e1472 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,10 @@ Available Commands: version Print version Flags: - -f, --filter string only display images matching specified pattern (case-insensitive) - -h, --help help for roulette - -p, --port int port to listen on (default 8080) - -r, --recursive recurse into subdirectories - -v, --verbose log accessed files to stdout + -h, --help help for roulette + -p, --port uint16 port to listen on (default 8080) + -r, --recursive recurse into subdirectories + -v, --verbose log accessed files to stdout Use "roulette [command] --help" for more information about a command. -``` \ No newline at end of file +``` diff --git a/cmd/root.go b/cmd/root.go index 58181cd..78ea90c 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Port int +var Port uint16 var Recursive bool var Verbose bool @@ -31,7 +31,7 @@ func Execute() { } func init() { - rootCmd.Flags().IntVarP(&Port, "port", "p", 8080, "port to listen on") + rootCmd.Flags().Uint16VarP(&Port, "port", "p", 8080, "port to listen on") rootCmd.Flags().BoolVarP(&Recursive, "recursive", "r", false, "recurse into subdirectories") rootCmd.Flags().BoolVarP(&Verbose, "verbose", "v", false, "log accessed files to stdout") rootCmd.Flags().SetInterspersed(true) diff --git a/cmd/version.go b/cmd/version.go index ce24da5..eb13fd5 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -10,7 +10,7 @@ import ( "github.com/spf13/cobra" ) -var Version = "0.13.2" +var Version = "0.13.3" func init() { rootCmd.AddCommand(versionCmd) diff --git a/cmd/web.go b/cmd/web.go index 119700d..929eeab 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -320,7 +320,7 @@ func ServePage(args []string) error { http.Handle(PREFIX+"/", http.StripPrefix(PREFIX, serveStaticFileHandler(paths))) http.HandleFunc("/favicon.ico", doNothing) - err = http.ListenAndServe(":"+strconv.Itoa(Port), nil) + err = http.ListenAndServe(":"+strconv.FormatInt(int64(Port), 10), nil) if err != nil { return err }