From 44d6620b32f31c04663c9e08a1c3954273230ee8 Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Tue, 25 Nov 2025 20:52:35 -0500 Subject: Tidy the code --- cmd/parser/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'cmd/parser/main.go') diff --git a/cmd/parser/main.go b/cmd/parser/main.go index 44fca42..0ef8b4d 100644 --- a/cmd/parser/main.go +++ b/cmd/parser/main.go @@ -35,7 +35,7 @@ func mdServe(w http.ResponseWriter, r *http.Request) { writeErr(w, http.StatusMethodNotAllowed, "Method Not Allowed") return } - + err := r.ParseMultipartForm(4 << 20) if err != nil { writeErr(w, http.StatusUnprocessableEntity, fmt.Sprintf("Failed to retrieve form data: %v", err)) @@ -48,25 +48,25 @@ func mdServe(w http.ResponseWriter, r *http.Request) { userId := r.Form.Get("user_id") shouldCreateShort := len(md) > 255 - + err = mdParser.Convert([]byte(md), &longBuf) if err != nil { writeErr(w, http.StatusUnprocessableEntity, fmt.Sprintf("Failed to compile markdown into html: %v", err)) return } - + var shortMd string if shouldCreateShort { shortMd = md[0:249] err = mdParser.Convert([]byte(shortMd), &shortBuf) - + if err != nil { writeErr(w, http.StatusUnprocessableEntity, fmt.Sprintf("Failed to compile markdown into html: %v", err)) return } } - ctx, cancel := context.WithTimeout(r.Context(), 5 * time.Second) + ctx, cancel := context.WithTimeout(r.Context(), 5*time.Second) defer cancel() tx, err := db.BeginTx(ctx, nil) @@ -155,7 +155,7 @@ func main() { } srv := &http.Server{ - Addr: fmt.Sprintf(":%d", appPort), + Addr: fmt.Sprintf(":%d", appPort), Handler: router, } -- cgit v1.2.3