fix command run path bug (#52)

* rebase upstream

* rebase

* trim no need line

* trim no need line

* trim no need line

* optimized go path logic

Co-authored-by: kingxt <dream4kingxt@163.com>
This commit is contained in:
kingxt
2020-09-08 12:19:34 +08:00
committed by GitHub
parent ff7c14c6b6
commit 4408767981
5 changed files with 24 additions and 16 deletions

View File

@@ -19,6 +19,7 @@ func getParentPackage(dir string) (string, error) {
if err != nil {
return "", err
}
if len(p.GoMod.Path) > 0 {
goModePath := filepath.Clean(filepath.Dir(p.GoMod.Path))
absPath, err := filepath.Abs(dir)
@@ -30,7 +31,7 @@ func getParentPackage(dir string) (string, error) {
return parent, nil
}
return p.GoMod.Module, nil
return p.Package, nil
}
func writeIndent(writer io.Writer, indent int) {