imroc / req

Simple Go HTTP client with Black Magic
https://req.cool
MIT License
4.12k stars 334 forks source link

why "trace is not enabled" when RemoteAddr is nil? #311

Closed GingerMoon closed 6 months ago

GingerMoon commented 6 months ago

Hi imroc,

May I know why "trace is not enabled" when RemoteAddr is nil? This error message seems to be a little confusing. Please feel to let me know if a PR is needed.

func (t TraceInfo) Blame() string { if t.RemoteAddr == nil { return "trace is not enabled" } ...

imroc commented 6 months ago

TraceInfo is designed without method of pointer, if trace is not enabled, TraceInfo should be an empty struct with all empty value field, RemoteAddr is one of the field must not empty if trace is enabled, so, if trace is not enabled, RemoteAddr is nil, otherwise not nil.

GingerMoon commented 6 months ago

thanks! The reason why I was asking is because I enabled DevMode, but still got trace is not enabled error. Now it cannot be reproduced. I'd like to close the issue.