fix(goctl): repeat creation protoc-gen-goctl symlink (#1162)
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/logrusorgru/aurora"
|
"github.com/logrusorgru/aurora"
|
||||||
"github.com/tal-tech/go-zero/core/load"
|
"github.com/tal-tech/go-zero/core/load"
|
||||||
@@ -686,11 +685,12 @@ func linkProtocGenGoctl() error {
|
|||||||
if len(ext) > 0 {
|
if len(ext) > 0 {
|
||||||
target = target + ext
|
target = target + ext
|
||||||
}
|
}
|
||||||
|
_, err = os.Lstat(target)
|
||||||
err = syscall.Unlink(target)
|
|
||||||
if err != nil && !os.IsNotExist(err) {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if os.IsNotExist(err) {
|
||||||
return os.Symlink(path, target)
|
return os.Symlink(path, target)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user