kill nil panic possibility
This commit is contained in:
parent
2c8a813b71
commit
7a1c1e3180
4
sort.go
4
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()")
|
||||
|
|
Loading…
Reference in New Issue