From bacf94f3d51940e8532cc5747bf7a9f67465421c Mon Sep 17 00:00:00 2001 From: bonfy Date: Fri, 12 Jul 2019 10:02:57 +0800 Subject: [PATCH] fix --- cobra/cmd/project.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cobra/cmd/project.go b/cobra/cmd/project.go index 688ec7d9..6cf0449e 100644 --- a/cobra/cmd/project.go +++ b/cobra/cmd/project.go @@ -93,7 +93,7 @@ func NewProjectFromPath(absPath string) *Project { p := new(Project) - p.absPath = findCmdSuffix(absPath) + p.absPath = findCmdPath(absPath) p.name = filepath.ToSlash(trimSrcPath(p.absPath, p.SrcPath())) return p } @@ -131,13 +131,13 @@ func (p *Project) CmdPath() string { return p.cmdPath } -// findCmdSuffix returns the cmd dir start with file path separator. -func findCmdSuffix(path string) string { +// findCmdPath returns the cmd path. +func findCmdPath(path string) string { cmdDir := findCmdDir(path) if filepathHasPrefix(cmdDir, string(os.PathSeparator)) { return strings.TrimSuffix(path, cmdDir) } - return return strings.TrimSuffix(path, string(os.PathSeparator) + cmdDir) + return strings.TrimSuffix(path, string(os.PathSeparator)+cmdDir) } // findCmdDir checks if base of absPath is cmd dir and returns it or