diff --git a/Makefile.d/functions.mk b/Makefile.d/functions.mk index e8dcb51c1a..9710a92f4a 100644 --- a/Makefile.d/functions.mk +++ b/Makefile.d/functions.mk @@ -431,7 +431,7 @@ define gen-deadlink-checker -tags "osusergo netgo static_build" \ -trimpath \ -o $$BIN_PATH $(ROOTDIR)/hack/tools/deadlink/main.go; \ - $$BIN_PATH -path $3 -ignore-path $4 -format $5 $1; \ + $$BIN_PATH -path $3 -ignore-path $4 -format $5 $1; \ rm -rf $$BIN_PATH endef diff --git a/hack/tools/deadlink/main.go b/hack/tools/deadlink/main.go index ff3a8b12da..201b577e62 100644 --- a/hack/tools/deadlink/main.go +++ b/hack/tools/deadlink/main.go @@ -235,19 +235,22 @@ func main() { eg.Go(func() error { for k, v := range url { mu.Lock() - defer mu.Unlock() if _, ok := r.errLinks[k]; ok { atomic.AddInt32(&fail, 1) + mu.Unlock() continue } var code int if strings.Contains(v, BASE_URL) { code = exec(v, cli) - } else if c, ok := exLinks[v]; ok { - code = c } else { - code = exec(v, cli) - exLinks[v] = code + if c, ok := exLinks[v]; ok { + code = c + } else { + code = exec(v, cli) + exLinks[v] = code + } + mu.Unlock() } if code == 200 { atomic.AddInt32(&success, 1)