From 5812a84c285295021f3d567d9d50d6ae93cbc519 Mon Sep 17 00:00:00 2001 From: Calvin Leung Huang Date: Wed, 22 Aug 2018 15:49:24 -0700 Subject: [PATCH] command/namespace: Move trailing slash check to the end (#5163) --- command/namespace_create.go | 8 +++++--- command/namespace_delete.go | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/command/namespace_create.go b/command/namespace_create.go index 17e2d34e0..b17b4a38b 100644 --- a/command/namespace_create.go +++ b/command/namespace_create.go @@ -85,12 +85,14 @@ func (c *NamespaceCreateCommand) Run(args []string) int { return 2 } - if !strings.HasSuffix(namespacePath, "/") { - namespacePath = namespacePath + "/" - } if c.flagNamespace != notSetNamespace { namespacePath = path.Join(c.flagNamespace, namespacePath) } + + if !strings.HasSuffix(namespacePath, "/") { + namespacePath = namespacePath + "/" + } + // Output full path c.UI.Output(fmt.Sprintf("Success! Namespace created at: %s", namespacePath)) return 0 diff --git a/command/namespace_delete.go b/command/namespace_delete.go index 416f0f31b..58a0b484f 100644 --- a/command/namespace_delete.go +++ b/command/namespace_delete.go @@ -90,13 +90,14 @@ func (c *NamespaceDeleteCommand) Run(args []string) int { return OutputSecret(c.UI, secret) } - if !strings.HasSuffix(namespacePath, "/") { - namespacePath = namespacePath + "/" - } if c.flagNamespace != notSetNamespace { namespacePath = path.Join(c.flagNamespace, namespacePath) } + if !strings.HasSuffix(namespacePath, "/") { + namespacePath = namespacePath + "/" + } + c.UI.Output(fmt.Sprintf("Success! Namespace deleted at: %s", namespacePath)) return 0 }