From 95c8fd56f5c493d8d67be2bfa1fa85b3ffc54be0 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 25 Jul 2019 10:41:31 -0400 Subject: [PATCH 1/2] rget: fail server with more helpful info Signed-off-by: Vincent Batts --- rget/cmd/server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rget/cmd/server.go b/rget/cmd/server.go index 2cd4262..89d0228 100644 --- a/rget/cmd/server.go +++ b/rget/cmd/server.go @@ -128,6 +128,10 @@ func (r sumRepo) handler(resp http.ResponseWriter, req *http.Request) { } func server(cmd *cobra.Command, args []string) { + if len(args) < 2 { + fmt.Printf("missing required arguments (public git URL, private git URL)\n") + os.Exit(1) + } pubgit := args[0] privgit := args[1] From 0be33b62b43542fa9c3a3a9028780184872c1612 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 25 Jul 2019 10:44:38 -0400 Subject: [PATCH 2/2] reget: redundant error formatting Signed-off-by: Vincent Batts --- rget/cmd/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rget/cmd/server.go b/rget/cmd/server.go index 89d0228..3c3b808 100644 --- a/rget/cmd/server.go +++ b/rget/cmd/server.go @@ -165,7 +165,7 @@ func server(cmd *cobra.Command, args []string) { } if !strings.HasSuffix(host, "."+rgetwellknown.PublicServiceHost) { - return nil, errors.New(fmt.Sprintf("not in TLD %v", rgetwellknown.PublicServiceHost)) + return nil, fmt.Errorf("not in TLD %v", rgetwellknown.PublicServiceHost) } key := strings.TrimSuffix(host, "."+rgetwellknown.PublicServiceHost)