support k8s deployment yaml generation (#247)
* simplify code, format makefile * simplify code * some optimize by kevwan and benying (#240) Co-authored-by: 杨志泉 <zhiquan.yang@yiducloud.cn> * optimization (#241) * optimize docker file generation, make docker build faster * support k8s deployment yaml generation Co-authored-by: benying <31179034+benyingY@users.noreply.github.com> Co-authored-by: 杨志泉 <zhiquan.yang@yiducloud.cn> Co-authored-by: bittoy <bittoy@qq.com>
This commit is contained in:
@@ -80,3 +80,30 @@ func FindGoModPath(dir string) (string, bool) {
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
func FindProjectPath(loc string) (string, bool) {
|
||||
var dir string
|
||||
if strings.IndexByte(loc, '/') == 0 {
|
||||
dir = loc
|
||||
} else {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return "", false
|
||||
}
|
||||
|
||||
dir = filepath.Join(wd, loc)
|
||||
}
|
||||
|
||||
for {
|
||||
if FileExists(filepath.Join(dir, goModeIdentifier)) {
|
||||
return dir, true
|
||||
}
|
||||
|
||||
dir = filepath.Dir(dir)
|
||||
if dir == "/" {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return "", false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user