I was having an issue when I was passing string in http.NewRequest in golang body param.
The error I got was :
cannot use req.Body (type string) as type io.Reader in argument to http.NewRequest: string does not implement io.Reader (missing Read method)
Similarly there are other use cases where the Buffer is required as an input instead of a particular type or an array of it. eg, byte[] when input required is buffer.
What did the error mean and what are ways of solving it and understanding what golang is trying to enforce.
Edit: This was the line I was having an issue with and did not find any references.
http.NewRequest(req.Method, req.Url, req.Body)
http.NewRequest(req.Method, req.Url, strings.NewReader(req.Body)) solves the issue. I was planning to add the answer as well (as an FYI type of question)