From 1847a3b4e81bd1c9253b582cc4af0c5db383e72e Mon Sep 17 00:00:00 2001 From: yuancjun Date: Thu, 28 Oct 2021 19:28:36 +0800 Subject: [PATCH] fix `gf install` command path id column output is not continuous. --- command/install/install.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/command/install/install.go b/command/install/install.go index 2bd3035..0afdedd 100644 --- a/command/install/install.go +++ b/command/install/install.go @@ -190,6 +190,10 @@ func checkPathAndAppendToInstallFolderPath(folderPaths []installFolderPath, path if !writable && !installed { return folderPaths } + // Ignore appended path. + if isAppended(folderPaths, path) { + return folderPaths + } return append( folderPaths, installFolderPath{ @@ -204,3 +208,13 @@ func checkPathAndAppendToInstallFolderPath(folderPaths []installFolderPath, path func isInstalled(path string) bool { return gfile.Exists(path) } + +// Check if this gf binary path appended. +func isAppended(folderPaths []installFolderPath, path string) bool { + for _, folderPath := range folderPaths { + if folderPath.path == path { + return true + } + } + return false +}