From a39086cb250fdfa2502d825c4881706009690339 Mon Sep 17 00:00:00 2001 From: Dmitry Kutakov Date: Sun, 10 Jul 2022 15:51:13 +0200 Subject: [PATCH] clone - simplify complexity of getting hostStr The usage of `host` variable could be limited by one if-block. Also since error is checked from `config.DefaultHost()` we could assume that `host` is not nil anymore. --- commands/clone.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/commands/clone.go b/commands/clone.go index d05986f28..84c71e465 100644 --- a/commands/clone.go +++ b/commands/clone.go @@ -103,20 +103,15 @@ func getCloneURL(nameWithOwner string, allowPush, allowPrivate bool) string { name = split[1] } - var host *github.Host + var hostStr string if owner == "" { config := github.CurrentConfig() - h, err := config.DefaultHost() + host, err := config.DefaultHost() if err != nil { utils.Check(github.FormatError("cloning repository", err)) } - host = h owner = host.User - } - - var hostStr string - if host != nil { hostStr = host.Host }