From 9fd3f752d1d5140b6aa31a5539a094e0b61dc166 Mon Sep 17 00:00:00 2001 From: zeromake Date: Fri, 29 Oct 2021 09:56:51 +0800 Subject: [PATCH] fix(goctl): repeat creation protoc-gen-goctl symlink (#1162) --- tools/goctl/goctl.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/goctl/goctl.go b/tools/goctl/goctl.go index b6a1a041..f98c6587 100644 --- a/tools/goctl/goctl.go +++ b/tools/goctl/goctl.go @@ -5,7 +5,6 @@ import ( "os" "path/filepath" "runtime" - "syscall" "github.com/logrusorgru/aurora" "github.com/tal-tech/go-zero/core/load" @@ -686,11 +685,12 @@ func linkProtocGenGoctl() error { if len(ext) > 0 { target = target + ext } - - err = syscall.Unlink(target) + _, err = os.Lstat(target) if err != nil && !os.IsNotExist(err) { return err } - - return os.Symlink(path, target) + if os.IsNotExist(err) { + return os.Symlink(path, target) + } + return nil }