1. BuildStreamURL: net.ParseIP() returns nil for non-IP hostnames (e.g., "example.com"), then calling nil.To4() panics. Add nil check before calling To4(). 2. ParseBody: defer r.Close() is placed after the ReadAll error check. If ReadAll fails, the function returns early without closing r, causing a resource leak. Move defer to the top of the function. |
||
|---|---|---|
| .. | ||
| utils_test.go | ||
| utils.go | ||