Merge branches 'goctl-sql-fix' and 'master' of github.com:anqiansong/go-zero into goctl-sql-fix

 Conflicts:
	tools/modelctl/model/modelgen/gen.go
This commit is contained in:
anqiansong
2020-08-16 23:42:21 +08:00
72 changed files with 885 additions and 191 deletions

View File

@@ -4,7 +4,6 @@ import (
"fmt"
"os"
"path"
"path/filepath"
"strings"
"github.com/tal-tech/go-zero/tools/goctl/vars"
@@ -44,16 +43,3 @@ func PathFromGoSrc() (string, error) {
// skip slash
return dir[len(parent)+1:], nil
}
func GetParentPackage(dir string) (string, error) {
absDir, err := filepath.Abs(dir)
if err != nil {
return "", err
}
pos := strings.Index(absDir, vars.ProjectName)
if pos < 0 {
return "", fmt.Errorf("error dir:[%s],please make sure that your project is in the %s directory", vars.ProjectName, dir)
}
return absDir[pos:], nil
}