8000 Bug in helpers.ReaderToString(reader io.ReadCloser) string · Issue #34 · XeroAPI/xerogolang · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.

Bug in helpers.ReaderToString(reader io.ReadCloser) string #34

Open
deze333 opened this issue Nov 1, 2019 · 0 comments
Open

Bug i 72A6 n helpers.ReaderToString(reader io.ReadCloser) string #34

deze333 opened this issue Nov 1, 2019 · 0 comments

Comments

@deze333
Copy link
deze333 commented Nov 1, 2019

A small bug in helpers.go that results in:

  • the function must return a string, not print it, as a (unwanted) result errors get printed twice to console
  • (unneeded) call to fmt.Printf(newString) missing format string resulting in %v appended to output

As a workaround I simply commented out unneeded lines:

//ReaderToString converts an io.ReadCloser to a string
func ReaderToString(reader io.ReadCloser) string {
	if reader == nil {
		return ""
	}
	buf := new(bytes.Buffer)
	_, err := buf.ReadFrom(reader)
	if err != nil {
		return ""
	}
	newString := buf.String()
	// BUG: Not needed
	// _, err = fmt.Printf(newString) // incomplete arguments list
	// if err != nil {
	// 	return ""
	// }
	return newString
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0