On Wed, Oct 19, 2016, at 03:34 PM, Brian Picciano wrote: > Hi there! My use-case involves reading all data off of an io.Reader > and scanning it into a receiver value provided by the user of my > library. In many ways the same thing as fmt.Fscan. The difference is > that only one receiver value is allowed, and I want to read _all_ data > until io.EOF, not just until space or newline. So if my data is "hello > world" and I'm scanning into a string, that string should have "hello > world" in it. If my data is "12 OK" and I'm scanning into an int, that > should error because the entirety of the data is not a parseable > integer. > > If there was a fmt.Scanf which simply had no delimiter, or where the > delimiter was somehow set to io.EOF, I think that would work for what > I'm doing. But I can't find anything like that. Does anyone know of > anything that could help me do this? Or do I just have to implement > it myself?
Could you write a Reader that send a delimiter in the stream when it encounters io.EOF? Then pass that reader to Fscan. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.