I'm trying to read bytes from a src using Reader.Read
but when I print out the data I'm noticing random characters interspersed throughout the output at the beginning of lines which makes me think I'm not clearing the buffer correctly but I'm not sure how to do it being new to Go.
numRead := 1
for numRead > 0 {
p := make([]byte, 100)
numRead, _ = hijack.Reader.Read(p) //hijack is a struct that points to a reader
p = p[:numRead]
fmt.Printf("%s", p)
}
Some lines come out okay like
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/plugin-support/1.0-alpha-1/plugin-support-1.0-alpha-1.pom (5 KB at 25.1 KB/sec)
Others will have a character at the beginning like this
hDownloaded: https://repo.maven.apache.org/maven2/org/apache/apache/4/apache-4.pom (5 KB at 27.4 KB/sec)