diff options
author | Jordan <me@jordan.im> | 2024-06-22 19:03:45 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2024-06-22 19:03:45 -0700 |
commit | cd5c5a81fb863c7ff8543e50e1d1186078025191 (patch) | |
tree | cd043b7e827e6293c90f09f7be1f3405f2aa5da7 /http.go | |
parent | 9339a52bf2a3a6cf360403ed856b08a313729edb (diff) | |
download | crane-cd5c5a81fb863c7ff8543e50e1d1186078025191.tar.gz crane-cd5c5a81fb863c7ff8543e50e1d1186078025191.zip |
performance: pointers > copies
Diffstat (limited to 'http.go')
-rw-r--r-- | http.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -67,7 +67,7 @@ func (papers *Papers) IndexHandler(w http.ResponseWriter, r *http.Request) { http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) return } - res := Resp{Papers: *papers} + res := Resp{Papers: papers} err := indexTemp.Execute(w, &res) if err != nil { fmt.Println(err) @@ -78,7 +78,7 @@ func (papers *Papers) IndexHandler(w http.ResponseWriter, r *http.Request) { // additional forms to modify the collection (add, delete, rename...) func (papers *Papers) AdminHandler(w http.ResponseWriter, r *http.Request) { - res := Resp{Papers: *papers} + res := Resp{Papers: papers} if user != "" && pass != "" { username, password, ok := r.BasicAuth() if ok && user == username && pass == password { @@ -98,7 +98,7 @@ func (papers *Papers) AdminHandler(w http.ResponseWriter, r *http.Request) { // a checkbox to each unique paper and category for modification func (papers *Papers) EditHandler(w http.ResponseWriter, r *http.Request) { - res := Resp{Papers: *papers} + res := Resp{Papers: papers} if user != "" && pass != "" { username, password, ok := r.BasicAuth() if !ok || user != username || pass != password { @@ -228,7 +228,7 @@ func (papers *Papers) AddHandler(w http.ResponseWriter, r *http.Request) { res.Status = fmt.Sprintf("category %q added successfully", nc) } } - res.Papers = *papers + res.Papers = papers adminTemp.Execute(w, &res) } |