x/net/html: Tokenizer could have a Position method #28343
Labels
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10.4 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?amd64/linux
What did you do?
I have a program that reads HTML streams and extracts sections of interest.
These byte slices are currently copied of from tokenizer.Raw().
But I'd rather just store the offsets and lengths into the full stream, given that I still want to hang on to the stream anyway. This would reduce the amount of copying needed and make my application more efficient.
This would be really easy if html.Tokenizer had a method Position() that would return the offset of the start of the current token (or possibly the start and end of the current token) from the start of the stream returned by its reader.
What did you expect to see?
A method Position() that tells me the offset of the start of the current token. And maybe also the end as the second return value.
What did you see instead?
There's no such method. And there's no such count either in the struct.
The text was updated successfully, but these errors were encountered: