From 7a1c1e318045165f14894ce4a12e3105a68eb3cc Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 1 Dec 2024 16:43:08 -0600 Subject: [PATCH] kill nil panic possibility --- sort.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sort.go b/sort.go index f7f9ff9..1b8cd0e 100644 --- a/sort.go +++ b/sort.go @@ -319,6 +319,10 @@ func iterDeleteWithCopy(w io.Writer, names map[string]string) { func iterFind(w io.Writer, names map[string]string) { fmt.Fprintln(w, "// find a dependancy by the go path") fmt.Fprintln(w, "func (all *"+names["Bases"]+") FindBy"+names["append"]+"(s string) *"+names["Base"]+" {") + fmt.Fprintln(w, " if all == nil {") + fmt.Fprintln(w, " return nil") + fmt.Fprintln(w, " }") + fmt.Fprintln(w, "") if sortmap["lock"] == "all" { fmt.Fprintln(w, " "+names["lock"]+".Lock.RLock()") fmt.Fprintln(w, " defer "+names["lock"]+".Lock.RUnlock()")