mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 09:00:20 +08:00
parent
a6c8113419
commit
fa0c364982
@ -120,11 +120,6 @@ func generateDockerfile(goFile string, port int, version string, args ...string)
|
||||
|
||||
if len(projPath) == 0 {
|
||||
projPath = "."
|
||||
} else {
|
||||
pos := strings.IndexByte(projPath, os.PathSeparator)
|
||||
if pos >= 0 {
|
||||
projPath = projPath[pos+1:]
|
||||
}
|
||||
}
|
||||
|
||||
out, err := util.CreateIfNotExist(dockerfileName)
|
||||
@ -169,6 +164,12 @@ func getFilePath(file string) (string, error) {
|
||||
if err != nil {
|
||||
return "", errors.New("no go.mod found, or not in GOPATH")
|
||||
}
|
||||
|
||||
// ignore project root directory for GOPATH mode
|
||||
pos := strings.IndexByte(projPath, os.PathSeparator)
|
||||
if pos >= 0 {
|
||||
projPath = projPath[pos+1:]
|
||||
}
|
||||
}
|
||||
|
||||
return projPath, nil
|
||||
|
Loading…
Reference in New Issue
Block a user