style consistency
Ted Unangst tedu@tedunangst.com
Mon, 21 Oct 2019 01:29:39 -0400
4 files changed,
30 insertions(+),
28 deletions(-)
M
activity.go
→
activity.go
@@ -1195,16 +1195,16 @@ rcpts[a] = true
} } if honk.Public { - for _, f := range getdubs(user.ID) { - if f.XID == user.URL { + for _, h := range getdubs(user.ID) { + if h.XID == user.URL { continue } var box *Box - ok := boxofboxes.Get(f.XID, &box) + ok := boxofboxes.Get(h.XID, &box) if ok && box.Shared != "" { rcpts["%"+box.Shared] = true } else { - rcpts[f.XID] = true + rcpts[h.XID] = true } } }
M
database.go
→
database.go
@@ -63,15 +63,15 @@ }
defer rows.Close() var honkers []*Honker for rows.Next() { - var f Honker + h := new(Honker) var combos string - err = rows.Scan(&f.ID, &f.UserID, &f.Name, &f.XID, &f.Flavor, &combos) - f.Combos = strings.Split(strings.TrimSpace(combos), " ") + err = rows.Scan(&h.ID, &h.UserID, &h.Name, &h.XID, &h.Flavor, &combos) + h.Combos = strings.Split(strings.TrimSpace(combos), " ") if err != nil { log.Printf("error scanning honker: %s", err) return nil } - honkers = append(honkers, &f) + honkers = append(honkers, h) } return honkers }@@ -85,13 +85,13 @@ }
defer rows.Close() var honkers []*Honker for rows.Next() { - var f Honker - err = rows.Scan(&f.ID, &f.UserID, &f.Name, &f.XID, &f.Flavor) + h := new(Honker) + err = rows.Scan(&h.ID, &h.UserID, &h.Name, &h.XID, &h.Flavor) if err != nil { log.Printf("error scanning honker: %s", err) return nil } - honkers = append(honkers, &f) + honkers = append(honkers, h) } return honkers }@@ -298,14 +298,14 @@ }
defer rows.Close() for rows.Next() { var hid int64 - var d Donk + d := new(Donk) err = rows.Scan(&hid, &d.FileID, &d.XID, &d.Name, &d.Desc, &d.URL, &d.Media, &d.Local) if err != nil { log.Printf("error scanning donk: %s", err) continue } h := hmap[hid] - h.Donks = append(h.Donks, &d) + h.Donks = append(h.Donks, d) } rows.Close()
M
fun.go
→
fun.go
@@ -329,14 +329,15 @@ if err != nil {
log.Printf("error saving meme: %s", err) return x } - var d Donk - d.FileID = fileid - d.XID = "" - d.Name = name - d.Media = ct - d.URL = url - d.Local = false - honk.Donks = append(honk.Donks, &d) + d := &Donk{ + FileID: fileid, + XID: "", + Name: name, + Media: ct, + URL: url, + Local: false, + } + honk.Donks = append(honk.Donks, d) return "" } honk.Noise = re_memes.ReplaceAllStringFunc(honk.Noise, repl)
M
web.go
→
web.go
@@ -1160,13 +1160,14 @@ if err != nil {
log.Printf("unable to save image: %s", err) return } - var d Donk - d.FileID = fileid - d.XID = xid - d.Desc = desc - d.URL = url - d.Local = true - honk.Donks = append(honk.Donks, &d) + d := &Donk{ + FileID: fileid, + XID: xid, + Desc: desc, + URL: url, + Local: true, + } + honk.Donks = append(honk.Donks, d) donkxid = xid } } else {