sample-golang
sample-golang copied to clipboard
Minor improvements: modern methods, less panic-prone
Minor code update:
- Using
r.URL.Query().Get("...")
instead ofr.URL.Query()["..."]
where this is the case - Using modern
strings.Cut
instead ofstrings.SplitN(..., 2)
- Bumping required go version up to 1.18 to enable
strings.Cut
using - Fixing panic-prone code
w.Header().Set(h[0], strings.TrimSpace(h[1]))
, whereh
can have arbitrary length - Dealing with
ROUTES
similarly toPORT
: checklen()
of value