Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct previous changes related to FindElementByTagNested #3

Merged
merged 1 commit into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func (d *Dataset) transferSyntax() (binary.ByteOrder, bool, error) {
// FindElementByTagNested searches through the dataset and returns a pointer to the matching element.
// This call searches through a flat representation of the dataset, including within sequences.
func (d *Dataset) FindElementByTagNested(tag tag.Tag) (*Element, error) {
c := dataset.FlatIterator()
defer ExhaustElementChannel(c)
c := d.FlatIterator()
defer ExhaustElementChannel(c)
for e := range c {
if e.Tag == tag {
return e, nil
Expand All @@ -73,13 +73,14 @@ func (d *Dataset) FindElementByTagNested(tag tag.Tag) (*Element, error) {
// If for some reason your code will not exhaust the iterator (read all
// elements), be sure to call ExhaustElementChannel to prevent leaving the
// underlying Goroutine alive (you can safely do this in a defer).
// c := dataset.FlatIterator()
// defer ExhaustElementChannel(c)
// for elem := range c {
// // Even if you exit before reading everything in c (e.g. due to an
// // error)
// // things will be ok.
// }
//
// c := dataset.FlatIterator()
// defer ExhaustElementChannel(c)
// for elem := range c {
// // Even if you exit before reading everything in c (e.g. due to an
// // error)
// // things will be ok.
// }
//
// Note that the sequence element itself is sent on the channel in addition to
// the child elements in the sequence.
Expand Down
1 change: 0 additions & 1 deletion dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,5 @@ func ExampleDataset_String() {
// VL: 0
// Value: &{[200]}
// ]
// test

}