From 71763e18f687444d259f6567b5fd51543cbecdb6 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Fri, 3 Nov 2017 13:28:08 +0900 Subject: [PATCH] Reduce copying args when global --- plugins/config/subcommands.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/config/subcommands.go b/plugins/config/subcommands.go index dc35bcf3b..919aaed38 100644 --- a/plugins/config/subcommands.go +++ b/plugins/config/subcommands.go @@ -150,7 +150,7 @@ func getEnvironment(appName string, merged bool) (env *Env) { //getCommonArgs extracts common positional args (appName and keys) func getCommonArgs(global bool, args []string) (appName string, keys []string) { - nextArg := 0 + keys = args if !global { if len(args) > 0 { appName = args[0] @@ -158,9 +158,8 @@ func getCommonArgs(global bool, args []string) (appName string, keys []string) { if appName == "" { common.LogFail("Please specify an app or --global") } else { - nextArg++ + keys = args[1:] } } - keys = args[nextArg:] return appName, keys }