I want to use request.Body(type io.ReadCloser) , which contains the image.
I do not want to use ioutil.ReadAll() , because I want to write this body directly to a file, and I also want to decode it, so I want to use the link to the content for subsequent function calls,
I tried to create multiple instances of the reader, such as those shown below
package main import ( "io/ioutil" "log" "strings" ) func main() { r := strings.NewReader("some io.Reader stream to be read\n") a := &r b := &r log.Println(ioutil.ReadAll(*a)) log.Println(ioutil.ReadAll(*b)) }
but in the second call it is always output in nil .
Please help me, how can I pass several separate links for the same reader?
source share